"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Help/command/target_link_libraries.rst" between
cmake-3.13.4.tar.gz and cmake-3.14.0-rc1.tar.gz

About: CMake is a cross-platform build system designed to build, test and package software. Release candidate.

target_link_libraries.rst  (cmake-3.13.4):target_link_libraries.rst  (cmake-3.14.0-rc1)
skipping to change at line 17 skipping to change at line 17
Specify libraries or flags to use when linking a given target and/or Specify libraries or flags to use when linking a given target and/or
its dependents. :ref:`Usage requirements <Target Usage Requirements>` its dependents. :ref:`Usage requirements <Target Usage Requirements>`
from linked library targets will be propagated. Usage requirements from linked library targets will be propagated. Usage requirements
of a target's dependencies affect compilation of its own sources. of a target's dependencies affect compilation of its own sources.
Overview Overview
^^^^^^^^ ^^^^^^^^
This command has several signatures as detailed in subsections below. This command has several signatures as detailed in subsections below.
All of them have the general form:: All of them have the general form
.. code-block:: cmake
target_link_libraries(<target> ... <item>... ...) target_link_libraries(<target> ... <item>... ...)
The named ``<target>`` must have been created by a command such as The named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an :command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`. If policy :policy:`CMP0079` is not :ref:`ALIAS target <Alias Targets>`. If policy :policy:`CMP0079` is not
set to ``NEW`` then the target must have been created in the current set to ``NEW`` then the target must have been created in the current
directory. Repeated calls for the same ``<target>`` append items in directory. Repeated calls for the same ``<target>`` append items in
the order called. the order called.
skipping to change at line 95 skipping to change at line 97
the linker. Use the :prop_tgt:`LINK_OPTIONS` target property or the linker. Use the :prop_tgt:`LINK_OPTIONS` target property or
:command:`target_link_options` command to add link :command:`target_link_options` command to add link
flags explicitly. The flags will then be placed at the toolchain-defined flags explicitly. The flags will then be placed at the toolchain-defined
flag position in the link command. flag position in the link command.
The link flag is treated as a command-line string fragment and The link flag is treated as a command-line string fragment and
will be used with no extra quoting or escaping. will be used with no extra quoting or escaping.
* **A generator expression**: A ``$<...>`` :manual:`generator expression * **A generator expression**: A ``$<...>`` :manual:`generator expression
<cmake-generator-expressions(7)>` may evaluate to any of the above <cmake-generator-expressions(7)>` may evaluate to any of the above
items or to a :ref:`;-list <CMake Language Lists>` of them. items or to a :ref:`semicolon-separated list <CMake Language Lists>` of them.
If the ``...`` contains any ``;`` characters, e.g. after evaluation If the ``...`` contains any ``;`` characters, e.g. after evaluation
of a ``${list}`` variable, be sure to use an explicitly quoted of a ``${list}`` variable, be sure to use an explicitly quoted
argument ``"$<...>"`` so that this command receives it as a argument ``"$<...>"`` so that this command receives it as a
single ``<item>``. single ``<item>``.
Additionally, a generator expression may be used as a fragment of Additionally, a generator expression may be used as a fragment of
any of the above items, e.g. ``foo$<1:_d>``. any of the above items, e.g. ``foo$<1:_d>``.
Note that generator expressions will not be used in OLD handling of Note that generator expressions will not be used in OLD handling of
policy :policy:`CMP0003` or policy :policy:`CMP0004`. policy :policy:`CMP0003` or policy :policy:`CMP0004`.
skipping to change at line 131 skipping to change at line 133
:ref:`IMPORTED <Imported Targets>` or :ref:`ALIAS <Alias Targets>` library :ref:`IMPORTED <Imported Targets>` or :ref:`ALIAS <Alias Targets>` library
target names and will cause an error if no such target exists. target names and will cause an error if no such target exists.
See policy :policy:`CMP0028`. See policy :policy:`CMP0028`.
See the :manual:`cmake-buildsystem(7)` manual for more on defining See the :manual:`cmake-buildsystem(7)` manual for more on defining
buildsystem properties. buildsystem properties.
Libraries for a Target and/or its Dependents Libraries for a Target and/or its Dependents
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:: .. code-block:: cmake
target_link_libraries(<target> target_link_libraries(<target>
<PRIVATE|PUBLIC|INTERFACE> <item>... <PRIVATE|PUBLIC|INTERFACE> <item>...
[<PRIVATE|PUBLIC|INTERFACE> <item>...]...) [<PRIVATE|PUBLIC|INTERFACE> <item>...]...)
The ``PUBLIC``, ``PRIVATE`` and ``INTERFACE`` keywords can be used to The ``PUBLIC``, ``PRIVATE`` and ``INTERFACE`` keywords can be used to
specify both the link dependencies and the link interface in one command. specify both the link dependencies and the link interface in one command.
Libraries and targets following ``PUBLIC`` are linked to, and are made Libraries and targets following ``PUBLIC`` are linked to, and are made
part of the link interface. Libraries and targets following ``PRIVATE`` part of the link interface. Libraries and targets following ``PRIVATE``
are linked to, but are not made part of the link interface. Libraries are linked to, but are not made part of the link interface. Libraries
following ``INTERFACE`` are appended to the link interface and are not following ``INTERFACE`` are appended to the link interface and are not
used for linking ``<target>``. used for linking ``<target>``.
Libraries for both a Target and its Dependents Libraries for both a Target and its Dependents
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:: .. code-block:: cmake
target_link_libraries(<target> <item>...) target_link_libraries(<target> <item>...)
Library dependencies are transitive by default with this signature. Library dependencies are transitive by default with this signature.
When this target is linked into another target then the libraries When this target is linked into another target then the libraries
linked to this target will appear on the link line for the other linked to this target will appear on the link line for the other
target too. This transitive "link interface" is stored in the target too. This transitive "link interface" is stored in the
:prop_tgt:`INTERFACE_LINK_LIBRARIES` target property and may be overridden :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property and may be overridden
by setting the property directly. When :policy:`CMP0022` is not set to by setting the property directly. When :policy:`CMP0022` is not set to
``NEW``, transitive linking is built in but may be overridden by the ``NEW``, transitive linking is built in but may be overridden by the
:prop_tgt:`LINK_INTERFACE_LIBRARIES` property. Calls to other signatures :prop_tgt:`LINK_INTERFACE_LIBRARIES` property. Calls to other signatures
of this command may set the property making any libraries linked of this command may set the property making any libraries linked
exclusively by this signature private. exclusively by this signature private.
Libraries for a Target and/or its Dependents (Legacy) Libraries for a Target and/or its Dependents (Legacy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:: .. code-block:: cmake
target_link_libraries(<target> target_link_libraries(<target>
<LINK_PRIVATE|LINK_PUBLIC> <lib>... <LINK_PRIVATE|LINK_PUBLIC> <lib>...
[<LINK_PRIVATE|LINK_PUBLIC> <lib>...]...) [<LINK_PRIVATE|LINK_PUBLIC> <lib>...]...)
The ``LINK_PUBLIC`` and ``LINK_PRIVATE`` modes can be used to specify both The ``LINK_PUBLIC`` and ``LINK_PRIVATE`` modes can be used to specify both
the link dependencies and the link interface in one command. the link dependencies and the link interface in one command.
This signature is for compatibility only. Prefer the ``PUBLIC`` or This signature is for compatibility only. Prefer the ``PUBLIC`` or
``PRIVATE`` keywords instead. ``PRIVATE`` keywords instead.
skipping to change at line 188 skipping to change at line 190
Libraries and targets following ``LINK_PUBLIC`` are linked to, and are Libraries and targets following ``LINK_PUBLIC`` are linked to, and are
made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy
:policy:`CMP0022` is not ``NEW``, they are also made part of the :policy:`CMP0022` is not ``NEW``, they are also made part of the
:prop_tgt:`LINK_INTERFACE_LIBRARIES`. Libraries and targets following :prop_tgt:`LINK_INTERFACE_LIBRARIES`. Libraries and targets following
``LINK_PRIVATE`` are linked to, but are not made part of the ``LINK_PRIVATE`` are linked to, but are not made part of the
:prop_tgt:`INTERFACE_LINK_LIBRARIES` (or :prop_tgt:`LINK_INTERFACE_LIBRARIES`). :prop_tgt:`INTERFACE_LINK_LIBRARIES` (or :prop_tgt:`LINK_INTERFACE_LIBRARIES`).
Libraries for Dependents Only (Legacy) Libraries for Dependents Only (Legacy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:: .. code-block:: cmake
target_link_libraries(<target> LINK_INTERFACE_LIBRARIES <item>...) target_link_libraries(<target> LINK_INTERFACE_LIBRARIES <item>...)
The ``LINK_INTERFACE_LIBRARIES`` mode appends the libraries to the The ``LINK_INTERFACE_LIBRARIES`` mode appends the libraries to the
:prop_tgt:`INTERFACE_LINK_LIBRARIES` target property instead of using them :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property instead of using them
for linking. If policy :policy:`CMP0022` is not ``NEW``, then this mode for linking. If policy :policy:`CMP0022` is not ``NEW``, then this mode
also appends libraries to the :prop_tgt:`LINK_INTERFACE_LIBRARIES` and its also appends libraries to the :prop_tgt:`LINK_INTERFACE_LIBRARIES` and its
per-configuration equivalent. per-configuration equivalent.
This signature is for compatibility only. Prefer the ``INTERFACE`` mode This signature is for compatibility only. Prefer the ``INTERFACE`` mode
 End of changes. 6 change blocks. 
6 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)