cmake/Help/command/add_link_options.rst

45 lines
1.3 KiB
ReStructuredText
Raw Normal View History

2018-10-28 12:09:07 +01:00
add_link_options
----------------
2021-09-14 00:13:48 +02:00
.. versionadded:: 3.13
2019-11-11 23:01:05 +01:00
Add options to the link step for executable, shared library or module
library targets in the current directory and below that are added after
this command is invoked.
2018-10-28 12:09:07 +01:00
2019-11-11 23:01:05 +01:00
.. code-block:: cmake
2018-10-28 12:09:07 +01:00
add_link_options(<option> ...)
2019-11-11 23:01:05 +01:00
This command can be used to add any link options, but alternative commands
exist to add libraries (:command:`target_link_libraries` or
:command:`link_libraries`). See documentation of the
2018-10-28 12:09:07 +01:00
:prop_dir:`directory <LINK_OPTIONS>` and
:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
2019-11-11 23:01:05 +01:00
.. note::
This command cannot be used to add options for static library targets,
since they do not use a linker. To add archiver or MSVC librarian flags,
see the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
2018-10-28 12:09:07 +01:00
2023-05-23 16:38:00 +02:00
.. |command_name| replace:: ``add_link_options``
.. include:: GENEX_NOTE.txt
2018-10-28 12:09:07 +01:00
2020-08-30 11:54:41 +02:00
.. include:: DEVICE_LINK_OPTIONS.txt
2018-10-28 12:09:07 +01:00
.. include:: OPTIONS_SHELL.txt
2018-11-29 20:27:00 +01:00
.. include:: LINK_OPTIONS_LINKER.txt
2023-05-23 16:38:00 +02:00
See Also
^^^^^^^^
* :command:`link_libraries`
* :command:`target_link_libraries`
* :command:`target_link_options`
2023-07-02 19:51:09 +02:00
* :variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
add language-wide flags passed to all invocations of the compiler.
This includes invocations that drive compiling and those that drive linking.