summaryrefslogtreecommitdiff
path: root/Help/policy
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-16 10:04:48 -0400
committerBrad King <brad.king@kitware.com>2022-05-16 10:39:42 -0400
commit4843a376767c2c4b46e29ed85ac823443317ca40 (patch)
tree0a957181b6b5e352e5793d2ff845b365fed50e59 /Help/policy
parent364fde65ee93588cb519ece09b161c0e8e826c3c (diff)
downloadcmake-4843a376767c2c4b46e29ed85ac823443317ca40.tar.gz
try_compile: Propagate platform variables in project-mode too
Add policy CMP0137 to propagate both our builtin variables and those listed by `CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` to `try_compile` whole-project builds. Inspired-by: Alexander Neumann <Alexander.Neumann@hamburg.de> Fixes: #23219
Diffstat (limited to 'Help/policy')
-rw-r--r--Help/policy/CMP0137.rst29
1 files changed, 29 insertions, 0 deletions
diff --git a/Help/policy/CMP0137.rst b/Help/policy/CMP0137.rst
new file mode 100644
index 0000000000..2efb9060b0
--- /dev/null
+++ b/Help/policy/CMP0137.rst
@@ -0,0 +1,29 @@
+CMP0137
+-------
+
+.. versionadded:: 3.24
+
+:command:`try_compile` passes platform variables in project mode.
+
+The :command:`try_compile` command :ref:`source file <Try Compiling Source
+Files>` signature propagates CMake variables containing platform settings,
+and those specified by the :variable:`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 :ref:`whole-project <Try Compiling Whole Projects>` signature does not
+propagate platform variables automatically. CMake 3.24 and above prefer to
+propagate platform variables in the :ref:`whole-project <Try Compiling Whole
+Projects>` 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 :ref:`whole-project <Try Compiling Whole Projects>` signature.
+The ``NEW`` behavior for this policy is to pass the same variables that the
+:ref:`source file <Try Compiling Source Files>` signature does.
+
+This policy was introduced in CMake version 3.24. Use the
+:command:`cmake_policy` command to set this policy to ``OLD`` or ``NEW``
+explicitly. Unlike many policies, CMake version |release| does *not* warn
+by default when this policy is not set and simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt