COMPILE_WARNING_AS_ERROR — CMake 3.30.5 Documentation

# COMPILE_WARNING_AS_ERROR

New in version 3.24.

Specify whether to treat warnings on compile as errors. If enabled, adds a flag to treat warnings on compile as errors. If the `cmake --compile-no-warning-as-error` option is given on the `cmake(1)` command line, this property is ignored.

This property is not implemented for all compilers. It is silently ignored if there is no implementation for the compiler being used. The currently implemented `compiler IDs` are:

- `GNU`

- `Clang`

- `AppleClang`

- `Fujitsu`

- `FujitsuClang`

- `IBMClang`

- `Intel`

- `IntelLLVM`

- `LCC`

- `MSVC`

- `NVHPC`

- `NVIDIA` (CUDA)

- `QCC`

- `SunPro`

- `Tasking`

- `TI`

- `VisualAge`

- `XL`

- `XLClang`

This property is initialized by the value of the variable `CMAKE_COMPILE_WARNING_AS_ERROR` if it is set when a target is created.