Files
cmake/Tests/RunCMake/ToolchainFile/CMP0210-WARN.cmake
T
Mickaël Germain 92320466dd try_compile: Restore platform-default link flags in pre-CMP0210 projects
The CMP0210 compatibility shims in the Darwin, AIX, HP-UX and ARMClang
modules read the policy with cmake_policy(GET CMP0210 ...) during
enable_language(), which runs inside project().  cmCoreTryCompile emitted
cmake_policy(SET CMP0210 ...) after project() in the generated test
project, so those shims always observed NEW regardless of the calling
project's setting.

On affected platforms this dropped the platform default link flags from
every try_compile, and left a toolchain-file value of
CMAKE_<LANG>_LINK_FLAGS unclobbered so that it reached the OLD code path.
For projects that are also not using CMP0181 NEW, that path uses the
variable as is and does not expand the LINKER: prefix.

Move the emission into the existing pre-project() policy block alongside
CMP0126, CMP0128 and CMP0197, which exist for exactly this reason.

Fixes: #28102
2026-09-21 11:35:38 -04:00

3 lines
41 B
CMake

# leave CMP0210 unset
enable_language(C)