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
This commit is contained in:
Craig Scott
2022-11-29 11:35:43 +00:00
committed by Kitware Robot
+7 -4
View File
@@ -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
^^^^^^^^