mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-08 16:19:36 -06:00
target_link_libraries: Add support for the LINKER: prefix
It is now possible to use the `LINKER:` prefix in `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` target properties. Fixes: #26318
This commit is contained in:
24
Help/command/LINK_LIBRARIES_LINKER.txt
Normal file
24
Help/command/LINK_LIBRARIES_LINKER.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
Handling Compiler Driver Differences
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionadded:: 3.32
|
||||
|
||||
To pass options to the linker tool, each compiler driver has its own syntax.
|
||||
The ``LINKER:`` prefix and ``,`` separator can be used to specify, in a portable
|
||||
way, options to pass to the linker tool. ``LINKER:`` is replaced by the
|
||||
appropriate driver option and ``,`` by the appropriate driver separator.
|
||||
The driver prefix and driver separator are given by the values of the
|
||||
:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` and
|
||||
:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variables.
|
||||
|
||||
For example, ``"LINKER:-z,defs"`` becomes ``-Xlinker -z -Xlinker defs`` for
|
||||
``Clang`` and ``-Wl,-z,defs`` for ``GNU GCC``.
|
||||
|
||||
The ``LINKER:`` prefix supports, as an alternative syntax, specification of
|
||||
arguments using the ``SHELL:`` prefix and space as separator. The previous
|
||||
example then becomes ``"LINKER:SHELL:-z defs"``.
|
||||
|
||||
.. note::
|
||||
|
||||
Specifying the ``SHELL:`` prefix anywhere other than at the beginning of the
|
||||
``LINKER:`` prefix is not supported.
|
||||
@@ -148,6 +148,8 @@ command lines.
|
||||
See the :manual:`cmake-buildsystem(7)` manual for more on defining
|
||||
buildsystem properties.
|
||||
|
||||
.. include:: ../command/LINK_LIBRARIES_LINKER.txt
|
||||
|
||||
Libraries for a Target and/or its Dependents
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ direct link dependencies of a target's dependents by using the
|
||||
:prop_tgt:`INTERFACE_LINK_LIBRARIES_DIRECT` and
|
||||
:prop_tgt:`INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE` target properties.
|
||||
|
||||
.. include:: ../command/LINK_LIBRARIES_LINKER.txt
|
||||
|
||||
Creating Relocatable Packages
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -8,3 +8,9 @@ INTERFACE_LINK_OPTIONS
|
||||
.. |PROPERTY_INTERFACE_NAME| replace:: ``INTERFACE_LINK_OPTIONS``
|
||||
.. |PROPERTY_LINK| replace:: :prop_tgt:`LINK_OPTIONS`
|
||||
.. include:: INTERFACE_BUILD_PROPERTY.txt
|
||||
|
||||
.. include:: ../command/DEVICE_LINK_OPTIONS.txt
|
||||
|
||||
.. include:: ../command/OPTIONS_SHELL.txt
|
||||
|
||||
.. include:: ../command/LINK_OPTIONS_LINKER.txt
|
||||
|
||||
@@ -33,3 +33,5 @@ See the :variable:`CMAKE_LINK_LIBRARIES_STRATEGY` variable and
|
||||
corresponding :prop_tgt:`LINK_LIBRARIES_STRATEGY` target property
|
||||
for details on how CMake orders direct link dependencies on linker
|
||||
command lines.
|
||||
|
||||
.. include:: ../command/LINK_LIBRARIES_LINKER.txt
|
||||
|
||||
5
Help/release/dev/target_link_libraries-LINKER-prefix.rst
Normal file
5
Help/release/dev/target_link_libraries-LINKER-prefix.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
target_link_libraries-LINKER-prefix
|
||||
-----------------------------------
|
||||
|
||||
* The :command:`target_link_libraries` command gains the support of the
|
||||
``LINKER:`` prefix.
|
||||
Reference in New Issue
Block a user