diff --git a/Valentina.pro b/Valentina.pro index 79ddb9f73..88a4b619e 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -6,5 +6,27 @@ include(common.pri) error("Use at least Qt 5.0.0.") } +unix { + *-g++ { + GCC_VERSION = $$system("g++ -dumpversion") + contains(GCC_VERSION, 6.[0-9]) { + message( "g++ version 6.x found" ) + CONFIG += g++6 + } else { + contains(GCC_VERSION, 5.[0-9]) { + message( "g++ version 5.x found" ) + CONFIG += g++5 + } else { + contains(GCC_VERSION, 4.[0-9]) { + message( "g++ version 4.x found" ) + CONFIG += g++4 + } else { + message( "Unknown GCC configuration" ) + } + } + } + } +} + TEMPLATE = subdirs SUBDIRS = src diff --git a/common.pri b/common.pri index 02ef36ca6..6a3de2591 100644 --- a/common.pri +++ b/common.pri @@ -256,6 +256,25 @@ GCC_DEBUG_CXXFLAGS += \ -Wno-unused \ -ftrapv +# Since GCC 5 +g++5:GCC_DEBUG_CXXFLAGS += \ + -Wswitch-bool \ + -Wlogical-not-parentheses \ + -Wsizeof-array-argument \ + -Wbool-compare \ + -Wsuggest-final-types \ + -Wsuggest-final-methods + +# Since GCC 6 +g++6:GCC_DEBUG_CXXFLAGS += \ + -Wshift-negative-value \ + -Wshift-overflow \ + -Wshift-overflow=2 \ + -Wtautological-compare \ + -Wnull-dereference \ + -Wduplicated-cond \ + -Wmisleading-indentation + # Usefull Clang warnings keys. CLANG_DEBUG_CXXFLAGS += \ -O0 \ # Turn off oprimization.