From 869ee9bc666fb939f3052047c54719d2a60575fa Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 23 Sep 2019 09:17:13 +1000 Subject: [PATCH] Silence some recent gcc warnings which we can't fix Since the fixes for these are either outside our control (residing in Qt system headers), or break compatiblity with older compiler versions which we still support. --- CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 223de8c3c5d..e783d1dad90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -531,11 +531,23 @@ IF (PEDANTIC) ELSE (MSVC) # add warnings via flags (not as definitions as on Mac -Wall can not be overridden per language ) SET(_warnings "-Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing") + SET(WERROR FALSE CACHE BOOL "Treat build warnings as errors.") IF (WERROR) SET(_warnings "${_warnings} -Werror") ENDIF(WERROR) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_warnings}") + + # c++ only warnings + + # unavoidable - we can't avoid these, as older, supported compilers do not support removing the redundant move + SET(_warnings "${_warnings} -Wno-redundant-move") + + IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + # heaps of these thrown by Qt headers at the moment (sep 2019) + SET(_warnings "${_warnings} -Wno-deprecated-copy") + ENDIF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_warnings}") # Qt produces lots of warnings with strict aliasing (as of Qt 4.4.0 & GCC 4.3)