summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-11-29 11:35:43 +0000
committerKitware Robot <kwrobot@kitware.com>2022-11-29 06:35:55 -0500
commit512056158f8f7be1b99ca3f14274d686658174d4 (patch)
tree27cfa74754acc4b1522f7e77667212a1fd65aaa6
parent9553e72b0d5d5939537231c3012d0001d13015e7 (diff)
parentf03a1833e2b0608ca053df819772759698fbcdb6 (diff)
downloadcmake-512056158f8f7be1b99ca3f14274d686658174d4.tar.gz
Merge topic 'doc-add_compile_options-example'
f03a1833e2 Help: Update compiler-specific add_compile_options() example and prose Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7959
-rw-r--r--Help/command/add_compile_options.rst11
1 files changed, 7 insertions, 4 deletions
diff --git a/Help/command/add_compile_options.rst b/Help/command/add_compile_options.rst
index ad653573d5..0ccebc679b 100644
--- a/Help/command/add_compile_options.rst
+++ b/Help/command/add_compile_options.rst
@@ -28,13 +28,16 @@ this command is in a compiler-specific conditional clause:
.. code-block:: cmake
if (MSVC)
- # warning level 4 and all warnings as errors
- add_compile_options(/W4 /WX)
+ # warning level 4
+ add_compile_options(/W4)
else()
- # lots of warnings and all warnings as errors
- add_compile_options(-Wall -Wextra -pedantic -Werror)
+ # additional warnings
+ add_compile_options(-Wall -Wextra -Wpedantic)
endif()
+To set per-language options, use the :genex:`$<COMPILE_LANGUAGE>`
+or :genex:`$<COMPILE_LANGUAGE:languages>` generator expressions.
+
See Also
^^^^^^^^