aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Funk <kfunk@kde.org>2017-04-13 19:16:57 +0200
committerKevin Funk <kfunk@kde.org>2017-04-18 08:55:10 +0200
commit0348332744d21d9555e32a922d212b6ba50a354e (patch)
tree2e3a0de9087826ae412890bc06977127fdc2bf16
parent1eeae4015bca728160f651f781d73851cc4c43ae (diff)
downloadextra-cmake-modules-0348332744d21d9555e32a922d212b6ba50a354e.tar.gz
extra-cmake-modules-0348332744d21d9555e32a922d212b6ba50a354e.tar.bz2
KDECompilerSettings: Pass -Wvla & -Wdate-time
Summary: -Wvla: Warn because it's non-standard feature, not supported by MSVC to date -Wdate-time: Warn because using __TIME__ or __DATE__ prevents reproducible builds These warnings are being used for *building* Qt itself as well (cf. qt_common.prf in qtbase) Test Plan: No new warnings from rebuilding KDE Frameworks Reviewers: mpyne Reviewed By: mpyne Subscribers: mpyne, #frameworks, #build_system Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D5430
-rw-r--r--kde-modules/KDECompilerSettings.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake
index 1fe0661b..8f87ecc1 100644
--- a/kde-modules/KDECompilerSettings.cmake
+++ b/kde-modules/KDECompilerSettings.cmake
@@ -369,6 +369,16 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
# Make some warnings errors
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type")
endif()
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
+ (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5))
+ # -Wvla: use of variable-length arrays (an extension to C++)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wvla")
+endif()
+if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR
+ (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5))
+ # -Wdate-time: warn if we use __DATE__ or __TIME__ (we want to be able to reproduce the exact same binary)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdate-time")
+endif()
# -w1 turns on warnings and errors
# FIXME: someone needs to have a closer look at the Intel compiler options