Help: Specify how to order and modify transitively set property values.

This commit is contained in:
Stephen Kelly 2014-02-05 13:59:17 +01:00 committed by Brad King
parent 645500b413
commit fbe01bedbe
1 changed files with 21 additions and 1 deletions

View File

@ -178,7 +178,7 @@ Transitive Usage Requirements
----------------------------- -----------------------------
The usage requirements of a target can transitively propagate to dependents. The usage requirements of a target can transitively propagate to dependents.
The :command:`target_link_libraries` command also has ``PRIVATE``, The :command:`target_link_libraries` command has ``PRIVATE``,
``INTERFACE`` and ``PUBLIC`` keywords to control the propagation. ``INTERFACE`` and ``PUBLIC`` keywords to control the propagation.
.. code-block:: cmake .. code-block:: cmake
@ -221,6 +221,26 @@ each keyword:
PRIVATE serialization PRIVATE serialization
) )
Usage requirements are propagated by reading the ``INTERFACE_`` variants
of target properties from dependencies and appending the values to the
non-``INTERFACE_`` variants of the operand. For example, the
:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of dependencies is read and
appended to the :prop_tgt:`INCLUDE_DIRECTORIES` of the operand. In cases
where order is relevant and maintained, and the order resulting from the
:command:`target_link_libraries` calls does not allow correct compilation,
use of an appropriate command to set the property directly may update the
order.
For example, if the linked libraries for a target must be specified
in the order ``lib1`` ``lib2`` ``lib3`` , but the include directories must
be specified in the order ``lib3`` ``lib1`` ``lib2``:
.. code-block:: cmake
target_link_libraries(myExe lib1 lib2 lib3)
target_include_directories(myExe
PRIVATE $<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES:lib3>)
.. _`Compatible Interface Properties`: .. _`Compatible Interface Properties`:
Compatible Interface Properties Compatible Interface Properties