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:
parent
202c4ef28c
commit
bf08502b9c
|
@ -90,6 +90,7 @@ mark_as_advanced(
|
||||||
ZM_SYSTEMD
|
ZM_SYSTEMD
|
||||||
ZM_MANPAGE_DEST_PREFIX)
|
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_TEST_SUITE "Build the test suite" 0)
|
||||||
option(BUILD_MAN "Build man pages" 1)
|
option(BUILD_MAN "Build man pages" 1)
|
||||||
option(ASAN "DEBUGGING: Build with AddressSanitizer (ASan) support" 0)
|
option(ASAN "DEBUGGING: Build with AddressSanitizer (ASan) support" 0)
|
||||||
|
|
|
@ -5,6 +5,12 @@ target_compile_options(zm-warning-interface
|
||||||
-Wimplicit-fallthrough
|
-Wimplicit-fallthrough
|
||||||
-Wno-unused-parameter)
|
-Wno-unused-parameter)
|
||||||
|
|
||||||
|
if(ENABLE_WERROR)
|
||||||
|
target_compile_options(zm-warning-interface
|
||||||
|
INTERFACE
|
||||||
|
-Werror)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ASAN)
|
if(ASAN)
|
||||||
target_compile_options(zm-compile-option-interface
|
target_compile_options(zm-compile-option-interface
|
||||||
INTERFACE
|
INTERFACE
|
||||||
|
|
|
@ -9,6 +9,12 @@ target_compile_options(zm-warning-interface
|
||||||
-Wno-unused-parameter
|
-Wno-unused-parameter
|
||||||
-Woverloaded-virtual)
|
-Woverloaded-virtual)
|
||||||
|
|
||||||
|
if(ENABLE_WERROR)
|
||||||
|
target_compile_options(zm-warning-interface
|
||||||
|
INTERFACE
|
||||||
|
-Werror)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ASAN)
|
if(ASAN)
|
||||||
target_compile_options(zm-compile-option-interface
|
target_compile_options(zm-compile-option-interface
|
||||||
INTERFACE
|
INTERFACE
|
||||||
|
|
Loading…
Reference in New Issue