Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | include(CheckLinkerFlag OPTIONAL) |
2 | |||
3 | if (COMMAND check_linker_flag) |
||
4 | macro(llvm_check_linker_flag) |
||
5 | check_linker_flag(${ARGN}) |
||
6 | endmacro() |
||
7 | else() |
||
8 | # Until the minimum CMAKE version is 3.18 |
||
9 | |||
10 | include(CheckCXXCompilerFlag) |
||
11 | include(CMakePushCheckState) |
||
12 | |||
13 | # cmake builtin compatible, except we assume lang is C or CXX |
||
14 | function(llvm_check_linker_flag lang flag out_var) |
||
15 | cmake_policy(PUSH) |
||
16 | cmake_policy(SET CMP0056 NEW) |
||
17 | cmake_push_check_state() |
||
18 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}") |
||
19 | if("${lang}" STREQUAL "C") |
||
20 | check_c_compiler_flag("" ${out_var}) |
||
21 | elseif("${lang}" STREQUAL "CXX") |
||
22 | check_cxx_compiler_flag("" ${out_var}) |
||
23 | else() |
||
24 | message(FATAL_ERROR "\"${lang}\" is not C or CXX") |
||
25 | endif() |
||
26 | cmake_pop_check_state() |
||
27 | cmake_policy(POP) |
||
28 | endfunction() |
||
29 | endif() |