diff options
author | Martin Duffy <martin.duffy@kitware.com> | 2022-04-21 19:29:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-05-06 16:14:37 (GMT) |
commit | 76a08cd25332b74627802df8817068219b89161d (patch) | |
tree | a349756534c11634ac1fc919793801c78fbec612 /Modules/Compiler/Intel.cmake | |
parent | de802fc5a35780581948f7638f0f22c3974922dd (diff) | |
download | CMake-76a08cd25332b74627802df8817068219b89161d.zip CMake-76a08cd25332b74627802df8817068219b89161d.tar.gz CMake-76a08cd25332b74627802df8817068219b89161d.tar.bz2 |
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.
Diffstat (limited to 'Modules/Compiler/Intel.cmake')
-rw-r--r-- | Modules/Compiler/Intel.cmake | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake index 9a760c8..20989d2 100644 --- a/Modules/Compiler/Intel.cmake +++ b/Modules/Compiler/Intel.cmake @@ -13,6 +13,7 @@ include(Compiler/CMakeCommonCompilerMacros) if(CMAKE_HOST_WIN32) # MSVC-like macro(__compiler_intel lang) + set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all") endmacro() else() # GNU-like @@ -24,6 +25,7 @@ else() string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os") string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3") string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g") + set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror-all") set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}") if(CMAKE_${lang}_COMPILER_ARG1) |