From 094b9ebf35ad1124129c893b72b1f09ff039e97f Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 22 Jun 2017 14:13:58 +0100 Subject: [PATCH] Configure build to work with case fallthrough GCC7 warning. Refs #671 --- CMakeLists.txt | 6 ++++++ qrenderdoc/CMakeLists.txt | 5 +++++ renderdoc/CMakeLists.txt | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1c0e6659..1911fdd52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,6 +181,12 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") -Wno-reorder) if(CMAKE_COMPILER_IS_GNUCXX) list(APPEND warning_flags -Wno-unused-but-set-variable) + + # We keep the implicit fallthrough warning for now, but allow more + # comments to silence it. + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) + list(APPEND warning_flags -Wimplicit-fallthrough=2) + endif() endif() if(NOT CMAKE_BUILD_TYPE STREQUAL "Release") diff --git a/qrenderdoc/CMakeLists.txt b/qrenderdoc/CMakeLists.txt index ba5ddd18f..295749001 100644 --- a/qrenderdoc/CMakeLists.txt +++ b/qrenderdoc/CMakeLists.txt @@ -114,6 +114,11 @@ file(WRITE "OSX_ICONFILE=${CMAKE_CURRENT_BINARY_DIR}/RenderDoc.icns\n") # propagate build version info. Lots of escaping needed here to pass ""s into the define value +if(CMAKE_COMPILER_IS_GNUCXX) + file(APPEND + ${CMAKE_BINARY_DIR}/qrenderdoc/qrenderdoc_cmake.pri + "QMAKE_CXXFLAGS+=-Wno-unknown-warning -Wno-implicit-fallthrough\n") +endif() file(APPEND ${CMAKE_BINARY_DIR}/qrenderdoc/qrenderdoc_cmake.pri diff --git a/renderdoc/CMakeLists.txt b/renderdoc/CMakeLists.txt index fea64a21b..e2c502693 100644 --- a/renderdoc/CMakeLists.txt +++ b/renderdoc/CMakeLists.txt @@ -201,6 +201,11 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR APPLE) # -Wno-shift-negative-value available set_source_files_properties(3rdparty/jpeg-compressor/jpgd.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-warning-option -Wno-shift-negative-value") + + if(CMAKE_COMPILER_IS_GNUCXX) + set_property(SOURCE 3rdparty/jpeg-compressor/jpgd.cpp + APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unknown-warning -Wno-implicit-fallthrough") + endif() endif() add_library(rdoc OBJECT ${sources})