CMP0137ΒΆ

Added in version 3.24.

try_compile() passes platform variables in project mode.

The try_compile() command source file signature propagates CMake variables containing platform settings, and those specified by the CMAKE_TRY_COMPILE_PLATFORM_VARIABLES variable, into the generated test project. This helps the test project drive the toolchain the same way the calling project will. In CMake 3.23 and below, the whole-project signature does not propagate platform variables automatically. CMake 3.24 and above prefer to propagate platform variables in the whole-project signature. This policy provides compatibility with projects that have not been updated to expect the behavior.

The OLD behavior for this policy is to not pass any additional variables to the whole-project signature. The NEW behavior for this policy is to pass the same variables that the source file signature does.

Regardless of the policy setting, the CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES variable may be set to suppress passing the platform variables through either signature.

This policy was introduced in CMake version 3.24. It may be set by cmake_policy() or cmake_minimum_required(). If it is not set, CMake does not warn, and uses OLD behavior.

Note

The OLD behavior of a policy is deprecated by definition and may be removed in a future version of CMake.