From 25bbb2a4776d36b542857709bb0448a7ea030b59 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Fri, 10 Jun 2022 22:07:26 +0200 Subject: Change -Wundef warning to an error This should catch undefined preprocessor expressions, i.e. instead of showing a warning if FOO_BAR_H is undefined: #if FOO_BAR_H make the build fai lwith an error instead. This combined with using #cmakedefine01 (instead of #cmakedefine), could catch things like: https://invent.kde.org/pim/kdepim-runtime/-/commit/05a0e5bbfbb06ed6aa88640f25f563cf7e5b1330 --- kde-modules/KDECompilerSettings.cmake | 3 +++ 1 file changed, 3 insertions(+) (limited to 'kde-modules') diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 08881507..76ce357b 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -562,6 +562,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_KDE_GCC_COMMON_WARNING_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual") # Make some warnings errors set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type -Werror=init-self") + if (KDE_INTERNAL_COMPILERSETTINGS_LEVEL VERSION_GREATER_EQUAL 5.96.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=undef") + endif() endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5)) -- cgit v1.2.1