Skip to content

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 !6836 (merged), 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 (closed)
Issue: #23408
Backport: release

Edited by Brad King

Merge request reports