HeaderpadWorkaround.cmake 625 B

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