summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
Diffstat (limited to 'Help')
-rw-r--r--Help/manual/cmake-buildsystem.7.rst47
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst43
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/prop_tgt/TRANSITIVE_COMPILE_PROPERTIES.rst17
-rw-r--r--Help/release/dev/custom-transitive-properties.rst7
5 files changed, 115 insertions, 0 deletions
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index 93d55c7..4dc2306 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -602,6 +602,53 @@ linking consumers.
List of files on which linking the target's consumers depends, for
those that are executables, shared libraries, or module libraries.
+.. _`Custom Transitive Properties`:
+
+Custom Transitive Properties
+----------------------------
+
+.. versionadded:: 3.30
+
+The :genex:`TARGET_PROPERTY` generator expression evaluates the above
+`build specification <Target Build Specification_>`_ and
+`usage requirement <Target Usage Requirements_>`_ properties
+as builtin transitive properties. It also supports custom transitive
+properties defined by the :prop_tgt:`TRANSITIVE_COMPILE_PROPERTIES`
+property on the target and its link dependencies.
+
+For example:
+
+.. code-block:: cmake
+
+ add_library(example INTERFACE)
+ set_target_properties(example PROPERTIES
+ TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_C"
+
+ INTERFACE_CUSTOM_C "EXAMPLE_CUSTOM_C"
+ )
+
+ add_library(mylib STATIC mylib.c)
+ target_link_libraries(mylib PRIVATE example)
+ set_target_properties(mylib PROPERTIES
+ CUSTOM_C "MYLIB_PRIVATE_CUSTOM_C"
+ INTERFACE_CUSTOM_C "MYLIB_IFACE_CUSTOM_C"
+ )
+
+ add_executable(myexe myexe.c)
+ target_link_libraries(myexe PRIVATE mylib)
+ set_target_properties(myexe PROPERTIES
+ CUSTOM_C "MYEXE_CUSTOM_C"
+ )
+
+ add_custom_target(print ALL VERBATIM
+ COMMAND ${CMAKE_COMMAND} -E echo
+ # Prints "MYLIB_PRIVATE_CUSTOM_C;EXAMPLE_CUSTOM_C"
+ "$<TARGET_PROPERTY:mylib,CUSTOM_C>"
+
+ # Prints "MYEXE_CUSTOM_C"
+ "$<TARGET_PROPERTY:myexe,CUSTOM_C>"
+ )
+
.. _`Compatible Interface Properties`:
Compatible Interface Properties
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index d9b10b8..d0d751b 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -1810,6 +1810,49 @@ The expressions have special evaluation rules for some properties:
Evaluation of :prop_tgt:`INTERFACE_LINK_LIBRARIES` itself is not transitive.
+:ref:`Custom Transitive Properties`
+ .. versionadded:: 3.30
+
+ These are processed during evaluation as follows:
+
+ * Evaluation of :genex:`$<TARGET_PROPERTY:tgt,PROP>` for some property
+ ``PROP``, named without an ``INTERFACE_`` prefix,
+ checks the :prop_tgt:`TRANSITIVE_COMPILE_PROPERTIES`
+ property on target ``tgt``,
+ on targets named by its :prop_tgt:`LINK_LIBRARIES`, and on the
+ transitive closure of targets named by the linked targets'
+ :prop_tgt:`INTERFACE_LINK_LIBRARIES`.
+
+ If ``PROP`` is listed by one of those properties, then it evaluates as
+ a :ref:`semicolon-separated list <CMake Language Lists>` representing
+ the union of the value on the target itself with the values of the
+ corresponding ``INTERFACE_PROP`` on targets named by the target's
+ :prop_tgt:`LINK_LIBRARIES`:
+
+ * If ``PROP`` is named by :prop_tgt:`TRANSITIVE_COMPILE_PROPERTIES`,
+ evaluation of the corresponding ``INTERFACE_PROP`` is transitive over
+ the closure of the linked targets' :prop_tgt:`INTERFACE_LINK_LIBRARIES`,
+ excluding entries guarded by the :genex:`LINK_ONLY` generator expression.
+
+ * Evaluation of :genex:`$<TARGET_PROPERTY:tgt,INTERFACE_PROP>` for some
+ property ``INTERFACE_PROP``, named with an ``INTERFACE_`` prefix,
+ checks the :prop_tgt:`TRANSITIVE_COMPILE_PROPERTIES`
+ property on target ``tgt``,
+ and on the transitive closure of targets named by its
+ :prop_tgt:`INTERFACE_LINK_LIBRARIES`.
+
+ If the corresponding ``PROP`` is listed by one of those properties,
+ then ``INTERFACE_PROP`` evaluates as a
+ :ref:`semicolon-separated list <CMake Language Lists>` representing the
+ union of the value on the target itself with the value of the same
+ property on targets named by the target's
+ :prop_tgt:`INTERFACE_LINK_LIBRARIES`:
+
+ * If ``PROP`` is named by :prop_tgt:`TRANSITIVE_COMPILE_PROPERTIES`,
+ evaluation of the corresponding ``INTERFACE_PROP`` is transitive over
+ the closure of the target's :prop_tgt:`INTERFACE_LINK_LIBRARIES`,
+ excluding entries guarded by the :genex:`LINK_ONLY` generator expression.
+
:ref:`Compatible Interface Properties`
These evaluate as a single value combined from the target itself,
from targets named by the target's :prop_tgt:`LINK_LIBRARIES`, and
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 7e640df..48e1d54 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -401,6 +401,7 @@ Properties on Targets
/prop_tgt/Swift_MODULE_NAME
/prop_tgt/SYSTEM
/prop_tgt/TEST_LAUNCHER
+ /prop_tgt/TRANSITIVE_COMPILE_PROPERTIES
/prop_tgt/TYPE
/prop_tgt/UNITY_BUILD
/prop_tgt/UNITY_BUILD_BATCH_SIZE
diff --git a/Help/prop_tgt/TRANSITIVE_COMPILE_PROPERTIES.rst b/Help/prop_tgt/TRANSITIVE_COMPILE_PROPERTIES.rst
new file mode 100644
index 0000000..a7777c3
--- /dev/null
+++ b/Help/prop_tgt/TRANSITIVE_COMPILE_PROPERTIES.rst
@@ -0,0 +1,17 @@
+TRANSITIVE_COMPILE_PROPERTIES
+-----------------------------
+
+.. versionadded:: 3.30
+
+Properties that the :genex:`TARGET_PROPERTY` generator expression, on the
+target and its dependents, evaluates as the union of values collected from
+the transitive closure of link dependencies, excluding entries guarded by
+:genex:`LINK_ONLY`.
+
+The value is a :ref:`semicolon-separated list <CMake Language Lists>`
+of :ref:`custom transitive property <Custom Transitive Properties>` names.
+Any leading ``INTERFACE_`` prefix is ignored, e.g., ``INTERFACE_PROP`` is
+treated as just ``PROP``.
+
+See documentation of the :genex:`TARGET_PROPERTY` generator expression
+for details of custom transitive property evaluation.
diff --git a/Help/release/dev/custom-transitive-properties.rst b/Help/release/dev/custom-transitive-properties.rst
new file mode 100644
index 0000000..aafa2f2
--- /dev/null
+++ b/Help/release/dev/custom-transitive-properties.rst
@@ -0,0 +1,7 @@
+custom-transitive-properties
+----------------------------
+
+* The :genex:`TARGET_PROPERTY` generator expression learned to evaluate
+ :ref:`custom transitive properties <Custom Transitive Properties>`
+ defined by a new :prop_tgt:`TRANSITIVE_COMPILE_PROPERTIES`
+ target property.