Merge topic 'genex-link-properties'

ddb9442f48 GenEx: Fix TARGET_PROPERTY evaluation of transitive link properties
862b8e28ad GenEx: Teach TARGET_PROPERTY evaluation to optionally pierce LINK_ONLY
8d1d6a1437 Tests: Cover TARGET_PROPERTY genex evaluation of transitive link properties
abf607c2ec Tests: Cover TARGET_PROPERTY genex evaluation of transitive build properties
7d3d728a72 Help: Clarify CMP0099 documentation and summary text
79a3ae9a0d cmGeneratorExpressionDAGChecker: Simplify transitive property table
e8010b67c7 cmGeneratorExpressionDAGChecker: Make local generator available in constructor
b36fb3f6f1 cmGeneratorExpressionNode: Remove outdated lint suppression

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9473
This commit is contained in:
Brad King
2024-05-01 14:05:53 +00:00
committed by Kitware Robot
32 changed files with 431 additions and 167 deletions
+13 -4
View File
@@ -1282,7 +1282,7 @@ Compile Context
.. versionadded:: 3.27
Content of ``...``, when collecting
:ref:`usage requirements <Target Usage Requirements>`,
:ref:`transitive build properties <Transitive Build Properties>`,
otherwise it is the empty string. This is intended for use in an
:prop_tgt:`INTERFACE_LINK_LIBRARIES` and :prop_tgt:`LINK_LIBRARIES` target
properties, typically populated via the :command:`target_link_libraries` command.
@@ -1670,8 +1670,8 @@ Link Context
.. versionadded:: 3.1
Content of ``...``, except while collecting
:ref:`usage requirements <Target Usage Requirements>`,
Content of ``...``, except while collecting usage requirements from
:ref:`transitive build properties <Transitive Build Properties>`,
in which case it is the empty string. This is intended for use in an
:prop_tgt:`INTERFACE_LINK_LIBRARIES` target property, typically populated
via the :command:`target_link_libraries` command, to specify private link
@@ -1788,7 +1788,16 @@ The expressions have special evaluation rules for some properties:
of the value on the target itself with the values of the same properties on
targets named by the target's :prop_tgt:`INTERFACE_LINK_LIBRARIES`.
Evaluation is transitive over the closure of the target's
:prop_tgt:`INTERFACE_LINK_LIBRARIES`.
:prop_tgt:`INTERFACE_LINK_LIBRARIES`:
* For :ref:`Transitive Build Properties`, the transitive closure
*excludes* entries of :prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded
by the :genex:`LINK_ONLY` generator expression.
* For :ref:`Transitive Link Properties`, the transitive closure is
*includes* entries of :prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded
by the :genex:`LINK_ONLY` generator expression.
See policy :policy:`CMP0166`.
Evaluation of :prop_tgt:`INTERFACE_LINK_LIBRARIES` itself is not transitive.
+2 -1
View File
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.30
.. toctree::
:maxdepth: 1
CMP0166: TARGET_PROPERTY evaluates link properties transitively over private dependencies of static libraries. </policy/CMP0166>
CMP0165: enable_language() must not be called before project(). </policy/CMP0165>
CMP0164: add_library() rejects SHARED libraries when not supported by the platform. </policy/CMP0164>
CMP0163: The GENERATED source file property is now visible in all directories. </policy/CMP0163>
@@ -214,7 +215,7 @@ Policies Introduced by CMake 3.17
CMP0102: mark_as_advanced() does nothing if a cache entry does not exist. </policy/CMP0102>
CMP0101: target_compile_options honors BEFORE keyword in all scopes. </policy/CMP0101>
CMP0100: Let AUTOMOC and AUTOUIC process .hh header files. </policy/CMP0100>
CMP0099: Link properties are transitive over private dependency on static libraries. </policy/CMP0099>
CMP0099: Link properties are transitive over private dependencies of static libraries. </policy/CMP0099>
CMP0098: FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing. </policy/CMP0098>
Policies Introduced by CMake 3.16
+14 -5
View File
@@ -3,13 +3,16 @@ CMP0099
.. versionadded:: 3.17
Target link properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
:prop_tgt:`INTERFACE_LINK_DIRECTORIES` and :prop_tgt:`INTERFACE_LINK_DEPENDS`
are now transitive over private dependencies of static libraries.
Link properties are transitive over private dependencies of static libraries.
In CMake 3.16 and below the interface link properties attached to libraries
are not propagated for private dependencies of static libraries.
In CMake 3.16 and below, evaluation of target properties
:prop_tgt:`INTERFACE_LINK_OPTIONS`, :prop_tgt:`INTERFACE_LINK_DIRECTORIES`,
and :prop_tgt:`INTERFACE_LINK_DEPENDS` during buildsystem generation does not
follow private dependencies of static libraries, which appear in their
:prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded by :genex:`LINK_ONLY` generator
expressions.
Only the libraries themselves are propagated to link the dependent binary.
CMake 3.17 and later prefer to propagate all interface link properties.
This policy provides compatibility for projects that have not been updated
to expect the new behavior.
@@ -18,6 +21,12 @@ The ``OLD`` behavior for this policy is to not propagate interface link
properties. The ``NEW`` behavior of this policy is to propagate interface link
properties.
.. versionadded:: 3.30
Policy :policy:`CMP0166` makes :genex:`TARGET_PROPERTY` evaluation of
these three transitive link properties follow private dependencies of
static libraries too.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.17
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
.. include:: STANDARD_ADVICE.txt
+40
View File
@@ -0,0 +1,40 @@
CMP0166
-------
.. versionadded:: 3.30
:genex:`TARGET_PROPERTY` evaluates link properties transitively over private
dependencies of static libraries.
In CMake 3.29 and below, the :genex:`TARGET_PROPERTY` generator expression
evaluates properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
:prop_tgt:`INTERFACE_LINK_DIRECTORIES`, and :prop_tgt:`INTERFACE_LINK_DEPENDS`
as if they were :ref:`Transitive Build Properties` rather than
:ref:`Transitive Link Properties`, even when policy :policy:`CMP0099` is
set to ``NEW``. Private dependencies of static libraries, which appear in
their :prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded by :genex:`LINK_ONLY`
generator expressions, are not followed. This is inconsistent with
evaluation of the same target properties during buildsystem generation.
CMake 3.30 and above prefer that :genex:`TARGET_PROPERTY` evaluates
properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
:prop_tgt:`INTERFACE_LINK_DIRECTORIES`, and :prop_tgt:`INTERFACE_LINK_DEPENDS`
as :ref:`Transitive Link Properties` such that private dependencies of static
libraries, which appear in their :prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded
by :genex:`LINK_ONLY` generator expressions, are followed.
This policy provides compatibility for projects that have not been updated
to expect the new behavior.
The ``OLD`` behavior for this policy is for :genex:`TARGET_PROPERTY` to
evaluate properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
:prop_tgt:`INTERFACE_LINK_DIRECTORIES`, and :prop_tgt:`INTERFACE_LINK_DEPENDS`
as if they were :ref:`Transitive Build Properties` by not following private
dependencies of static libraries. The ``NEW`` behavior for this policy is
to evaluate them as :ref:`Transitive Link Properties` by following private
dependencies of static libraries.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
@@ -0,0 +1,8 @@
genex-link-properties
---------------------
* The :genex:`TARGET_PROPERTY` generator expression now evaluates target
properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
:prop_tgt:`INTERFACE_LINK_DIRECTORIES`, and
:prop_tgt:`INTERFACE_LINK_DEPENDS` correctly by following private
dependencies of static libraries. See policy :policy:`CMP0166`.