summaryrefslogtreecommitdiffstats
path: root/Help/command
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-11-29 11:35:43 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-11-29 11:35:55 (GMT)
commit512056158f8f7be1b99ca3f14274d686658174d4 (patch)
tree27cfa74754acc4b1522f7e77667212a1fd65aaa6 /Help/command
parent9553e72b0d5d5939537231c3012d0001d13015e7 (diff)
parentf03a1833e2b0608ca053df819772759698fbcdb6 (diff)
downloadCMake-512056158f8f7be1b99ca3f14274d686658174d4.zip
CMake-512056158f8f7be1b99ca3f14274d686658174d4.tar.gz
CMake-512056158f8f7be1b99ca3f14274d686658174d4.tar.bz2
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
Diffstat (limited to 'Help/command')
-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 ad65357..0ccebc6 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
^^^^^^^^