Files
CMake/Tests/RunCMake/CompileWarningAsError/WerrorOff.cmake
Martin Duffy 76a08cd253 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.
2022-05-06 12:14:37 -04:00

9 lines
267 B
CMake

enable_language(CXX)
include(WarningAsErrorOptions.cmake)
get_warning_options(warning_options)
add_executable(WerrorOff warn.cxx)
target_compile_options(WerrorOff PUBLIC "${warning_options}")
set_target_properties(WerrorOff PROPERTIES COMPILE_WARNING_AS_ERROR OFF)