CMP0137.rst 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. CMP0137
  2. -------
  3. .. versionadded:: 3.24
  4. :command:`try_compile` passes platform variables in project mode.
  5. The :command:`try_compile` command :ref:`source file <Try Compiling Source
  6. Files>` signature propagates CMake variables containing platform settings,
  7. and those specified by the :variable:`CMAKE_TRY_COMPILE_PLATFORM_VARIABLES`
  8. variable, into the generated test project. This helps the test project drive
  9. the toolchain the same way the calling project will. In CMake 3.23 and below,
  10. the :ref:`whole-project <Try Compiling Whole Projects>` signature does not
  11. propagate platform variables automatically. CMake 3.24 and above prefer to
  12. propagate platform variables in the :ref:`whole-project <Try Compiling Whole
  13. Projects>` signature. This policy provides compatibility with projects that
  14. have not been updated to expect the behavior.
  15. The ``OLD`` behavior for this policy is to not pass any additional variables to
  16. the :ref:`whole-project <Try Compiling Whole Projects>` signature.
  17. The ``NEW`` behavior for this policy is to pass the same variables that the
  18. :ref:`source file <Try Compiling Source Files>` signature does.
  19. Regardless of the policy setting, the
  20. :variable:`CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES` variable may be set
  21. to suppress passing the platform variables through either signature.
  22. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.24
  23. .. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
  24. .. include:: STANDARD_ADVICE.txt
  25. .. include:: DEPRECATED.txt