summaryrefslogtreecommitdiff
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-31 11:10:36 -0400
committerBrad King <brad.king@kitware.com>2023-03-31 11:30:51 -0400
commit561ae21f40d1416aee9a1b63be3b7bafa7b29231 (patch)
treeb5670100f3d4b95cba8dca58fb413ee99abe9028 /Help
parent530faee017ffaabb0315bc81405bdc2ef0995c62 (diff)
downloadcmake-561ae21f40d1416aee9a1b63be3b7bafa7b29231.tar.gz
Help: Clarify that {add,target}_compile_options are not used for linking
Link to alternatives that can be used for adding link options. Issue: #24662
Diffstat (limited to 'Help')
-rw-r--r--Help/command/add_compile_options.rst11
-rw-r--r--Help/command/add_link_options.rst4
-rw-r--r--Help/command/target_compile_options.rst9
-rw-r--r--Help/command/target_link_options.rst4
-rw-r--r--Help/variable/CMAKE_LANG_FLAGS.rst2
-rw-r--r--Help/variable/CMAKE_LANG_FLAGS_CONFIG.rst4
6 files changed, 31 insertions, 3 deletions
diff --git a/Help/command/add_compile_options.rst b/Help/command/add_compile_options.rst
index f587ae6063..869d0c2ced 100644
--- a/Help/command/add_compile_options.rst
+++ b/Help/command/add_compile_options.rst
@@ -11,6 +11,11 @@ Adds options to the :prop_dir:`COMPILE_OPTIONS` directory property.
These options are used when compiling targets from the current
directory and below.
+.. note::
+
+ These options are not used when linking.
+ See the :command:`add_link_options` command for that.
+
Arguments
^^^^^^^^^
@@ -54,3 +59,9 @@ See Also
* The source file property :prop_sf:`COMPILE_OPTIONS` adds options to one
source file.
+
+* :command:`add_link_options` adds options for linking.
+
+* :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.
diff --git a/Help/command/add_link_options.rst b/Help/command/add_link_options.rst
index c09e106908..df72715431 100644
--- a/Help/command/add_link_options.rst
+++ b/Help/command/add_link_options.rst
@@ -38,3 +38,7 @@ See Also
* :command:`link_libraries`
* :command:`target_link_libraries`
* :command:`target_link_options`
+
+* :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.
diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst
index f3ac97bd09..7cfb24b18f 100644
--- a/Help/command/target_compile_options.rst
+++ b/Help/command/target_compile_options.rst
@@ -15,6 +15,11 @@ are used when compiling the given ``<target>``, which 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>`.
+.. note::
+
+ These options are not used when linking the target.
+ See the :command:`target_link_options` command for that.
+
Arguments
^^^^^^^^^
@@ -60,3 +65,7 @@ See Also
* :command:`target_link_options`
* :command:`target_precompile_headers`
* :command:`target_sources`
+
+* :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.
diff --git a/Help/command/target_link_options.rst b/Help/command/target_link_options.rst
index 0d026f2456..dca9598611 100644
--- a/Help/command/target_link_options.rst
+++ b/Help/command/target_link_options.rst
@@ -62,3 +62,7 @@ See Also
* :command:`target_link_directories`
* :command:`target_precompile_headers`
* :command:`target_sources`
+
+* :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.
diff --git a/Help/variable/CMAKE_LANG_FLAGS.rst b/Help/variable/CMAKE_LANG_FLAGS.rst
index 747ac93e32..909a001a9c 100644
--- a/Help/variable/CMAKE_LANG_FLAGS.rst
+++ b/Help/variable/CMAKE_LANG_FLAGS.rst
@@ -33,5 +33,5 @@ per-configuration :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` variable.
On invocations driving compiling, flags from both variables will be passed
before flags added by commands such as :command:`add_compile_options` and
:command:`target_compile_options`. On invocations driving linking,
-they will be passed before before flags added by commands such as
+they will be passed before flags added by commands such as
:command:`add_link_options` and :command:`target_link_options`.
diff --git a/Help/variable/CMAKE_LANG_FLAGS_CONFIG.rst b/Help/variable/CMAKE_LANG_FLAGS_CONFIG.rst
index de7bd537ee..5daa4c06a1 100644
--- a/Help/variable/CMAKE_LANG_FLAGS_CONFIG.rst
+++ b/Help/variable/CMAKE_LANG_FLAGS_CONFIG.rst
@@ -11,6 +11,6 @@ The flags in this variable will be passed after those in the
:variable:`CMAKE_<LANG>_FLAGS` variable. On invocations driving compiling,
flags from both variables will be passed before flags added by commands
such as :command:`add_compile_options` and :command:`target_compile_options`.
-On invocations driving linking, they will be passed before before flags
-added by commands such as :command:`add_link_options` and
+On invocations driving linking, they will be passed before flags added by
+commands such as :command:`add_link_options` and
:command:`target_link_options`.