summaryrefslogtreecommitdiff
path: root/Help/policy
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-22 11:09:23 -0400
committerBrad King <brad.king@kitware.com>2022-03-24 08:23:55 -0400
commitcf312a2e5423c49cc5da446f5407a6f4a596a3cb (patch)
tree3bde9691ad13e40b06744b63a2c53dda75cbdf2a /Help/policy
parent41a6b4a53ba844ef986b0bc4efe8938b97eea810 (diff)
downloadcmake-cf312a2e5423c49cc5da446f5407a6f4a596a3cb.tar.gz
LINK_LIBRARIES: Add support for LINK_ONLY genex
Previously we always used content guarded by `$<LINK_ONLY:...>` in `LINK_LIBRARIES`, even when evaluating for non-linking usage requirements. Add a policy to honor `LINK_ONLY` in `LINK_LIBRARIES` the same way we already do in `INTERFACE_LINK_LIBRARIES`.
Diffstat (limited to 'Help/policy')
-rw-r--r--Help/policy/CMP0131.rst31
1 files changed, 31 insertions, 0 deletions
diff --git a/Help/policy/CMP0131.rst b/Help/policy/CMP0131.rst
new file mode 100644
index 0000000000..e85b8abda2
--- /dev/null
+++ b/Help/policy/CMP0131.rst
@@ -0,0 +1,31 @@
+CMP0131
+-------
+
+.. versionadded:: 3.24
+
+:prop_tgt:`LINK_LIBRARIES` supports the :genex:`$<LINK_ONLY:...>`
+generator expression.
+
+CMake 3.23 and below documented the :genex:`$<LINK_ONLY:...>` generator
+expression only for use in :prop_tgt:`INTERFACE_LINK_LIBRARIES`.
+When used in :prop_tgt:`LINK_LIBRARIES`, the content guarded inside
+:genex:`$<LINK_ONLY:...>` was always used, even when collecting non-linking
+usage requirements such as :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`.
+
+CMake 3.24 and above prefer to support :genex:`$<LINK_ONLY:...>`, when
+used in :prop_tgt:`LINK_LIBRARIES`, by using the guarded content only
+for link dependencies and not other usage requirements. This policy
+provides compatibility for projects that have not been updated to
+account for this change.
+
+The ``OLD`` behavior for this policy is to use :prop_tgt:`LINK_LIBRARIES`
+content guarded by :genex:`$<LINK_ONLY:...>` even for non-linking
+usage requirements. The ``NEW`` behavior for this policy is to to use
+the guarded content only for link dependencies.
+
+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 when this policy is not set, and simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt