Debian Codegraph @

Tests/RunCMake/CheckCompilerFlag/HeaderpadWorkaround.cmake

raw
1 enable_language(C)
2
3 include(CheckCompilerFlag)
4
5 # Confirm we can check the conflicting flag directly. This should pass with
6 # or without the workaround.
7 check_compiler_flag(C "-fembed-bitcode" result1)
8 if(NOT result1)
9 message(FATAL_ERROR "False negative when -fembed-bitcode tested directly")
10 endif()
11
12 # Check conflicting flag set by user or project won't cause a false negative
13 # when testing a valid flag. This only passes with the workaround.
14 set(CMAKE_C_FLAGS -fembed-bitcode)
15 check_compiler_flag(C "-O" result2)
16 if(NOT result2)
17 message(FATAL_ERROR "False negative when -fembed-bitcode set in CMAKE_C_FLAGS")
18 endif()