• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1add_link_options
2----------------
3
4.. versionadded:: 3.13
5
6Add options to the link step for executable, shared library or module
7library targets in the current directory and below that are added after
8this command is invoked.
9
10.. code-block:: cmake
11
12  add_link_options(<option> ...)
13
14This command can be used to add any link options, but alternative commands
15exist to add libraries (:command:`target_link_libraries` or
16:command:`link_libraries`).  See documentation of the
17:prop_dir:`directory <LINK_OPTIONS>` and
18:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
19
20.. note::
21
22  This command cannot be used to add options for static library targets,
23  since they do not use a linker.  To add archiver or MSVC librarian flags,
24  see the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
25
26Arguments to ``add_link_options`` may use "generator expressions" with
27the syntax ``$<...>``.  See the :manual:`cmake-generator-expressions(7)`
28manual for available expressions.  See the :manual:`cmake-buildsystem(7)`
29manual for more on defining buildsystem properties.
30
31.. include:: DEVICE_LINK_OPTIONS.txt
32
33.. include:: OPTIONS_SHELL.txt
34
35.. include:: LINK_OPTIONS_LINKER.txt
36