From 31b8e24ccc3c81a9147a90e9f67e82b553c42b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sat, 1 Mar 2025 12:16:04 +0000 Subject: [PATCH] CI: Enable -Werror for clazy since we're warning clean now While this is only being used for clazy now we could also enable it in CI for regular builds --- CMakeLists.txt | 12 ++++++++++++ CMakePresets.json | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cd11e86..6c69cd84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,18 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) ) endif() +if(CMAKE_COMPILE_WARNING_AS_ERROR) + # These -Wno-error flags are here to enable -Werror for clazy in CI + # it doesn't mean we endorse those warnings. + # MSVC is untested and probably will have a few hundered errors + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + add_compile_options(-Wno-error=deprecated-declarations) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_compile_options(-Wno-error=documentation -Wno-error=unused-private-field -Wno-error=c++20-extensions) + endif() + endif() +endif() + if(${PROJECT_NAME}_QT6) set(QT_VERSION_MAJOR 6) set(QT_MIN_VERSION "6.0.0") diff --git a/CMakePresets.json b/CMakePresets.json index f505e457..9d7e02c4 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -55,7 +55,8 @@ "inherits": "dev", "cacheVariables": { "KDSoap_EXAMPLES": "OFF", - "KDSoap_TESTS": "OFF" + "KDSoap_TESTS": "OFF", + "CMAKE_COMPILE_WARNING_AS_ERROR": "ON" }, "environment": { "CXX": "clazy",