summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
Diffstat (limited to 'Help')
-rw-r--r--Help/command/OPTIONS_SHELL.txt (renamed from Help/command/COMPILE_OPTIONS_SHELL.txt)2
-rw-r--r--Help/command/add_compile_options.rst2
-rw-r--r--Help/command/add_link_options.rst24
-rw-r--r--Help/command/target_compile_options.rst2
-rw-r--r--Help/command/target_link_libraries.rst3
-rw-r--r--Help/command/target_link_options.rst40
-rw-r--r--Help/manual/cmake-commands.7.rst2
-rw-r--r--Help/manual/cmake-properties.7.rst3
-rw-r--r--Help/prop_dir/LINK_OPTIONS.rst16
-rw-r--r--Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst9
-rw-r--r--Help/prop_tgt/LINK_FLAGS.rst8
-rw-r--r--Help/prop_tgt/LINK_FLAGS_CONFIG.rst4
-rw-r--r--Help/prop_tgt/LINK_OPTIONS.rst21
-rw-r--r--Help/release/dev/LINK_OPTIONS.rst11
14 files changed, 141 insertions, 6 deletions
diff --git a/Help/command/COMPILE_OPTIONS_SHELL.txt b/Help/command/OPTIONS_SHELL.txt
index a1316c8..530c012 100644
--- a/Help/command/COMPILE_OPTIONS_SHELL.txt
+++ b/Help/command/OPTIONS_SHELL.txt
@@ -1,4 +1,4 @@
-The final set of compile options used for a target is constructed by
+The final set of compile or link options used for a target is constructed by
accumulating options from the current target and the usage requirements of
it dependencies. The set of options is de-duplicated to avoid repetition.
While beneficial for individual options, the de-duplication step can break
diff --git a/Help/command/add_compile_options.rst b/Help/command/add_compile_options.rst
index c445608..350a1c0 100644
--- a/Help/command/add_compile_options.rst
+++ b/Help/command/add_compile_options.rst
@@ -22,4 +22,4 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
-.. include:: COMPILE_OPTIONS_SHELL.txt
+.. include:: OPTIONS_SHELL.txt
diff --git a/Help/command/add_link_options.rst b/Help/command/add_link_options.rst
new file mode 100644
index 0000000..c827d70
--- /dev/null
+++ b/Help/command/add_link_options.rst
@@ -0,0 +1,24 @@
+add_link_options
+----------------
+
+Adds options to the link of targets.
+
+::
+
+ add_link_options(<option> ...)
+
+Adds options to the linker command line for targets in the current
+directory and below that are added after this command is invoked.
+See documentation of the :prop_dir:`directory <LINK_OPTIONS>` and
+:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
+
+This command can be used to add any options, but alternative command
+exist to add libraries (:command:`target_link_libraries` or
+:command:`link_libraries`).
+
+Arguments to ``add_link_options`` may use "generator expressions" with
+the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions. See the :manual:`cmake-buildsystem(7)`
+manual for more on defining buildsystem properties.
+
+.. include:: OPTIONS_SHELL.txt
diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst
index 194d008..88b7f15 100644
--- a/Help/command/target_compile_options.rst
+++ b/Help/command/target_compile_options.rst
@@ -39,4 +39,4 @@ with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
-.. include:: COMPILE_OPTIONS_SHELL.txt
+.. include:: OPTIONS_SHELL.txt
diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst
index 6379730..edf38cf 100644
--- a/Help/command/target_link_libraries.rst
+++ b/Help/command/target_link_libraries.rst
@@ -70,7 +70,8 @@ Each ``<item>`` may be:
Link flags specified here are inserted into the link command in the same
place as the link libraries. This might not be correct, depending on
- the linker. Use the :prop_tgt:`LINK_FLAGS` target property to add link
+ the linker. Use the :prop_tgt:`LINK_OPTIONS` target property or
+ :command:`target_link_options` command to add link
flags explicitly. The flags will then be placed at the toolchain-defined
flag position in the link command.
diff --git a/Help/command/target_link_options.rst b/Help/command/target_link_options.rst
new file mode 100644
index 0000000..489f981
--- /dev/null
+++ b/Help/command/target_link_options.rst
@@ -0,0 +1,40 @@
+target_link_options
+-------------------
+
+Add link options to a target.
+
+::
+
+ target_link_options(<target> [BEFORE]
+ <INTERFACE|PUBLIC|PRIVATE> [items1...]
+ [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
+
+Specify link options to use when linking a given target. The
+named ``<target>`` must have been created by a command such as
+:command:`add_executable` or :command:`add_library` and must not be an
+:ref:`ALIAS target <Alias Targets>`.
+
+If ``BEFORE`` is specified, the content will be prepended to the property
+instead of being appended.
+
+This command can be used to add any options, but
+alternative commands exist to add libraries
+(:command:`target_link_libraries` and :command:`link_libraries`).
+See documentation of the :prop_dir:`directory <LINK_OPTIONS>` and
+:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
+
+The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
+specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC``
+items will populate the :prop_tgt:`LINK_OPTIONS` property of
+``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
+:prop_tgt:`INTERFACE_LINK_OPTIONS` property of ``<target>``.
+(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.)
+The following arguments specify compile options. Repeated calls for the same
+``<target>`` append items in the order called.
+
+Arguments to ``target_link_options`` may use "generator expressions"
+with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions. See the :manual:`cmake-buildsystem(7)`
+manual for more on defining buildsystem properties.
+
+.. include:: OPTIONS_SHELL.txt
diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst
index 408a3a0..753647d 100644
--- a/Help/manual/cmake-commands.7.rst
+++ b/Help/manual/cmake-commands.7.rst
@@ -78,6 +78,7 @@ These commands are available only in CMake projects.
/command/add_dependencies
/command/add_executable
/command/add_library
+ /command/add_link_options
/command/add_subdirectory
/command/add_test
/command/aux_source_directory
@@ -111,6 +112,7 @@ These commands are available only in CMake projects.
/command/target_compile_options
/command/target_include_directories
/command/target_link_libraries
+ /command/target_link_options
/command/target_sources
/command/try_compile
/command/try_run
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 9f9c53f..db900e8 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -77,6 +77,7 @@ Properties on Directories
/prop_dir/INTERPROCEDURAL_OPTIMIZATION
/prop_dir/LABELS
/prop_dir/LINK_DIRECTORIES
+ /prop_dir/LINK_OPTIONS
/prop_dir/LISTFILE_STACK
/prop_dir/MACROS
/prop_dir/PARENT_DIRECTORY
@@ -225,6 +226,7 @@ Properties on Targets
/prop_tgt/INTERFACE_COMPILE_OPTIONS
/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES
/prop_tgt/INTERFACE_LINK_LIBRARIES
+ /prop_tgt/INTERFACE_LINK_OPTIONS
/prop_tgt/INTERFACE_POSITION_INDEPENDENT_CODE
/prop_tgt/INTERFACE_SOURCES
/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
@@ -254,6 +256,7 @@ Properties on Targets
/prop_tgt/LINK_INTERFACE_MULTIPLICITY_CONFIG
/prop_tgt/LINK_INTERFACE_MULTIPLICITY
/prop_tgt/LINK_LIBRARIES
+ /prop_tgt/LINK_OPTIONS
/prop_tgt/LINK_SEARCH_END_STATIC
/prop_tgt/LINK_SEARCH_START_STATIC
/prop_tgt/LINK_WHAT_YOU_USE
diff --git a/Help/prop_dir/LINK_OPTIONS.rst b/Help/prop_dir/LINK_OPTIONS.rst
new file mode 100644
index 0000000..04b9e08
--- /dev/null
+++ b/Help/prop_dir/LINK_OPTIONS.rst
@@ -0,0 +1,16 @@
+LINK_OPTIONS
+------------
+
+List of options to use for the link step.
+
+This property holds a :ref:`;-list <CMake Language Lists>` of options
+given so far to the :command:`add_link_options` command.
+
+This property is used to initialize the :prop_tgt:`LINK_OPTIONS` target
+property when a target is created, which is used by the generators to set
+the options for the compiler.
+
+Contents of ``LINK_OPTIONS`` may use "generator expressions" with the
+syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual
+for available expressions. See the :manual:`cmake-buildsystem(7)` manual
+for more on defining buildsystem properties.
diff --git a/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst b/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst
new file mode 100644
index 0000000..c293b98
--- /dev/null
+++ b/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst
@@ -0,0 +1,9 @@
+INTERFACE_LINK_OPTIONS
+----------------------
+
+.. |property_name| replace:: link options
+.. |command_name| replace:: :command:`target_link_options`
+.. |PROPERTY_INTERFACE_NAME| replace:: ``INTERFACE_LINK_OPTIONS``
+.. |PROPERTY_LINK| replace:: :prop_tgt:`LINK_OPTIONS`
+.. |PROPERTY_GENEX| replace:: ``$<TARGET_PROPERTY:foo,INTERFACE_LINK_OPTIONS>``
+.. include:: INTERFACE_BUILD_PROPERTY.txt
diff --git a/Help/prop_tgt/LINK_FLAGS.rst b/Help/prop_tgt/LINK_FLAGS.rst
index b09e7c1..e0b72b5 100644
--- a/Help/prop_tgt/LINK_FLAGS.rst
+++ b/Help/prop_tgt/LINK_FLAGS.rst
@@ -3,7 +3,11 @@ LINK_FLAGS
Additional flags to use when linking this target.
-The LINK_FLAGS property can be used to add extra flags to the link
-step of a target. :prop_tgt:`LINK_FLAGS_<CONFIG>` will add to the
+The LINK_FLAGS property, managed as a string, can be used to add extra flags
+to the link step of a target. :prop_tgt:`LINK_FLAGS_<CONFIG>` will add to the
configuration ``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``,
``MINSIZEREL``, ``RELWITHDEBINFO``, ...
+
+.. note::
+
+ This property has been superseded by :prop_tgt:`LINK_OPTIONS` property.
diff --git a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst
index ba7adc8..1f2910b 100644
--- a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst
+++ b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst
@@ -4,3 +4,7 @@ LINK_FLAGS_<CONFIG>
Per-configuration linker flags for a target.
This is the configuration-specific version of LINK_FLAGS.
+
+.. note::
+
+ This property has been superseded by :prop_tgt:`LINK_OPTIONS` property.
diff --git a/Help/prop_tgt/LINK_OPTIONS.rst b/Help/prop_tgt/LINK_OPTIONS.rst
new file mode 100644
index 0000000..c5263a2
--- /dev/null
+++ b/Help/prop_tgt/LINK_OPTIONS.rst
@@ -0,0 +1,21 @@
+LINK_OPTIONS
+------------
+
+List of options to use when linking this target.
+
+This property holds a :ref:`;-list <CMake Language Lists>` of options
+specified so far for its target. Use the :command:`target_link_options`
+command to append more options.
+
+This property is initialized by the :prop_dir:`LINK_OPTIONS` directory
+property when a target is created, and is used by the generators to set
+the options for the compiler.
+
+Contents of ``LINK_OPTIONS`` may use "generator expressions" with the
+syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual
+for available expressions. See the :manual:`cmake-buildsystem(7)` manual
+for more on defining buildsystem properties.
+
+.. note::
+
+ This property must be used in preference to :prop_tgt:`LINK_FLAGS` property.
diff --git a/Help/release/dev/LINK_OPTIONS.rst b/Help/release/dev/LINK_OPTIONS.rst
new file mode 100644
index 0000000..87e7c40
--- /dev/null
+++ b/Help/release/dev/LINK_OPTIONS.rst
@@ -0,0 +1,11 @@
+LINK_OPTIONS
+------------
+
+* CMake gained new capabilities to manage link step:
+
+ * :prop_dir:`LINK_OPTIONS` directory property
+ * :prop_tgt:`LINK_OPTIONS` and :prop_tgt:`INTERFACE_LINK_OPTIONS` target
+ properties
+ * :command:`add_link_options` command to add link options in the current
+ directory
+ * :command:`target_link_options` command to add link options to targets