11include (CMakePushCheckState)
2-
3- include (CheckCompilerFlag OPTIONAL )
4-
5- if (NOT COMMAND check_compiler_flag)
6- include (CheckCCompilerFlag)
7- include (CheckCXXCompilerFlag)
8- endif ()
2+ include (CheckCompilerFlag)
93
104function (llvm_check_compiler_linker_flag lang flag out_var)
11- # If testing a flag with check_c_compiler_flag , it gets added to the compile
5+ # If testing a flag with check_compiler_flag , it gets added to the compile
126 # command only, but not to the linker command in that test. If the flag
137 # is vital for linking to succeed, the test would fail even if it would
148 # have succeeded if it was included on both commands.
@@ -18,18 +12,6 @@ function(llvm_check_compiler_linker_flag lang flag out_var)
1812
1913 cmake_push_check_state()
2014 set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag} " )
21- if (COMMAND check_compiler_flag)
22- check_compiler_flag("${lang} " "" ${out_var} )
23- else ()
24- # Until the minimum CMAKE version is 3.19
25- # cmake builtin compatible, except we assume lang is C or CXX
26- if ("${lang} " STREQUAL "C" )
27- check_c_compiler_flag("" ${out_var} )
28- elseif ("${lang} " STREQUAL "CXX" )
29- check_cxx_compiler_flag("" ${out_var} )
30- else ()
31- message (FATAL_ERROR "\" ${lang} \" is not C or CXX" )
32- endif ()
33- endif ()
15+ check_compiler_flag("${lang} " "" ${out_var} )
3416 cmake_pop_check_state()
3517endfunction ()
0 commit comments