From 0348332744d21d9555e32a922d212b6ba50a354e Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 13 Apr 2017 19:16:57 +0200 Subject: 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 --- kde-modules/KDECompilerSettings.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'kde-modules/KDECompilerSettings.cmake') 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 -- cgit v1.2.1