From: Ralf Habacker Date: Wed, 1 Dec 2021 15:03:22 +0000 (+0100) Subject: cmake: add configure option 'ENABLE_WERROR' to keep in sync with autotools X-Git-Tag: dbus-1.13.20~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e2f0f588e21ff835f87688c4df543ec6545f33d;p=thirdparty%2Fdbus.git cmake: add configure option 'ENABLE_WERROR' to keep in sync with autotools --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ba1a3971..3b57e4e01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,6 +233,8 @@ endif() string(APPEND CMAKE_C_FLAGS " -fno-common") string(APPEND CMAKE_CXX_FLAGS " -fno-common") +option(ENABLE_WERROR "Unconditionally make all compiler warnings fatal" OFF) + if(MSVC) # Use the highest warning level if(WALL) @@ -331,6 +333,9 @@ else() ) set(WARNINGS_ERRORS ) + if(ENABLE_WERROR) + list(APPEND WARNINGS error) + endif() endif() generate_compiler_warning_flags( diff --git a/README.cmake b/README.cmake index 7c984430f..1d32302a7 100644 --- a/README.cmake +++ b/README.cmake @@ -139,6 +139,9 @@ DBUS_ENABLE_ANSI:BOOL=OFF // build DOXYGEN documentation (requires Doxygen) DBUS_ENABLE_DOXYGEN_DOCS:BOOL=OFF +// Unconditionally make all compiler warnings fatal +ENABLE_WERROR:BOOL=OFF + // build qt help documentation (requires qhelpgenerator(-qt5)); // set INSTALL_QCH_DIR for custom qch installation path ENABLE_QT_HELP:STRING=AUTO