Build: Add CMake option to enable Werror

With -DENABLE_WERROR the -Werror flag will be passed to the compiler failing the build if a warning is emitted.
This commit is contained in:
Peter Keresztes Schmidt 2021-04-30 00:13:32 +02:00
parent 202c4ef28c
commit bf08502b9c
3 changed files with 13 additions and 0 deletions

View File

@ -90,6 +90,7 @@ mark_as_advanced(
ZM_SYSTEMD
ZM_MANPAGE_DEST_PREFIX)
option(ENABLE_WERROR "Fail the build if a compiler warning is emitted" 0)
option(BUILD_TEST_SUITE "Build the test suite" 0)
option(BUILD_MAN "Build man pages" 1)
option(ASAN "DEBUGGING: Build with AddressSanitizer (ASan) support" 0)

View File

@ -5,6 +5,12 @@ target_compile_options(zm-warning-interface
-Wimplicit-fallthrough
-Wno-unused-parameter)
if(ENABLE_WERROR)
target_compile_options(zm-warning-interface
INTERFACE
-Werror)
endif()
if(ASAN)
target_compile_options(zm-compile-option-interface
INTERFACE

View File

@ -9,6 +9,12 @@ target_compile_options(zm-warning-interface
-Wno-unused-parameter
-Woverloaded-virtual)
if(ENABLE_WERROR)
target_compile_options(zm-warning-interface
INTERFACE
-Werror)
endif()
if(ASAN)
target_compile_options(zm-compile-option-interface
INTERFACE