Files
CMake/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake
Craig Scott a10fc754a6 CheckSourceCompiles: Avoid linker warning with -fembed-bitcode
When the Apple linker sees -headerpad_max_install_names and
bitcode is enabled with a flag like -fembed-bitcode, it issues a warning
and ignores the -headerpad_max_install_names flag. This causes
unrelated compiler and linker flag checks to fail for valid flags.
In f745e0497e (CheckCompilerFlags: Catch linker warning about ignored
flags, 2022-01-03), we started detecting linker warnings, which caused
a regression for projects that were setting -fembed-bitcode in their
CMAKE_CXX_FLAGS or similar. Prevent that regression by removing
the -headerpad_max_install_names linker flag when we know it will
warn and be ignored anyway.

Fixes: #23390
Issue: #23408
2022-04-09 21:51:09 +10:00

33 lines
588 B
CMake

include(RunCMake)
run_cmake(NotEnabledLanguage)
run_cmake(NonExistentLanguage)
run_cmake(CheckCCompilerFlag)
run_cmake(CheckCXXCompilerFlag)
if (APPLE)
run_cmake(CheckOBJCCompilerFlag)
run_cmake(CheckOBJCXXCompilerFlag)
endif()
if (CMAKE_Fortran_COMPILER_ID)
run_cmake(CheckFortranCompilerFlag)
endif()
if (CMake_TEST_CUDA)
run_cmake(CheckCUDACompilerFlag)
endif()
if(CMake_TEST_ISPC)
run_cmake(CheckISPCCompilerFlag)
endif()
if(CMake_TEST_HIP)
run_cmake(CheckHIPCompilerFlag)
endif()
if(APPLE)
run_cmake_with_options(HeaderpadWorkaround --debug-trycompile)
endif()