mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 13:51:33 -06:00
COMPILE_WARNING_AS_ERROR: Add options to treat warnings as errors
Add `COMPILE_WARNING_AS_ERROR` target property and supporting `CMAKE_COMPILE_WARNING_AS_ERROR` variable. `COMPILE_WARNING_AS_ERROR` is initialized by `CMAKE_COMPILE_WARNING_AS_ERROR`. It is a boolean variable. If it is true, it expands to a different flag depending on the compiler such that any warnings at compile will be treated as errors. Supports compiler ids that I could find a relevant flag for.
This commit is contained in:
@@ -171,6 +171,7 @@ Properties on Targets
|
||||
/prop_tgt/COMPILE_PDB_NAME_CONFIG
|
||||
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY
|
||||
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
|
||||
/prop_tgt/COMPILE_WARNING_AS_ERROR
|
||||
/prop_tgt/CONFIG_OUTPUT_NAME
|
||||
/prop_tgt/CONFIG_POSTFIX
|
||||
/prop_tgt/CROSSCOMPILING_EMULATOR
|
||||
|
||||
@@ -399,6 +399,7 @@ Variables that Control the Build
|
||||
/variable/CMAKE_BUILD_WITH_INSTALL_RPATH
|
||||
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
|
||||
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
|
||||
/variable/CMAKE_COMPILE_WARNING_AS_ERROR
|
||||
/variable/CMAKE_CONFIG_POSTFIX
|
||||
/variable/CMAKE_CROSS_CONFIGS
|
||||
/variable/CMAKE_CTEST_ARGUMENTS
|
||||
|
||||
10
Help/prop_tgt/COMPILE_WARNING_AS_ERROR.rst
Normal file
10
Help/prop_tgt/COMPILE_WARNING_AS_ERROR.rst
Normal file
@@ -0,0 +1,10 @@
|
||||
COMPILE_WARNING_AS_ERROR
|
||||
------------------------
|
||||
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Specify whether to treat warnings on compile as errors.
|
||||
If enabled, adds a flag to treat warnings on compile as errors.
|
||||
|
||||
This property is initialized by the value of the variable
|
||||
:variable:`CMAKE_COMPILE_WARNING_AS_ERROR` if it is set when a target is created.
|
||||
8
Help/release/dev/werror-property.rst
Normal file
8
Help/release/dev/werror-property.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
werror-property
|
||||
---------------
|
||||
|
||||
* Added the Target Property :prop_tgt:`COMPILE_WARNING_AS_ERROR` and the
|
||||
Variable :variable:`CMAKE_COMPILE_WARNING_AS_ERROR` which initializes the
|
||||
Target Property. If :prop_tgt:`COMPILE_WARNING_AS_ERROR` is true, it expands
|
||||
to a different flag depending on the compiler such that any warnings at
|
||||
compile will be treated as errors.
|
||||
9
Help/variable/CMAKE_COMPILE_WARNING_AS_ERROR.rst
Normal file
9
Help/variable/CMAKE_COMPILE_WARNING_AS_ERROR.rst
Normal file
@@ -0,0 +1,9 @@
|
||||
CMAKE_COMPILE_WARNING_AS_ERROR
|
||||
------------------------------
|
||||
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Specify whether to treat warnings on compile as errors.
|
||||
|
||||
This variable is used to initialize the
|
||||
:prop_tgt:`COMPILE_WARNING_AS_ERROR` property on all the targets.
|
||||
Reference in New Issue
Block a user