diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2022-06-10 22:07:26 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2022-06-15 11:37:02 +0000 |
commit | 25bbb2a4776d36b542857709bb0448a7ea030b59 (patch) | |
tree | d06269725bfdefbf513651b7d4202c44c51eebe9 | |
parent | cf3b66289146ca9168f324460a688b2feeca1309 (diff) | |
download | extra-cmake-modules-25bbb2a4776d36b542857709bb0448a7ea030b59.tar.gz extra-cmake-modules-25bbb2a4776d36b542857709bb0448a7ea030b59.tar.bz2 |
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
-rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 3 |
1 files changed, 3 insertions, 0 deletions
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)) |