From 7d7c0daa5e7084e9fd9658516fc03cdaad6fdd21 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 2 Jun 2016 20:00:42 +0100 Subject: [PATCH] Added check against GCC version when adding the -Wshadow warning to OSG_AGGRESSIVE_WARNING_FLAGS so that it's only used in versions later than 4.9. --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8fbca69b..2c4a8915b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -954,7 +954,11 @@ IF(CMAKE_COMPILER_IS_GNUCXX) # errors instead of warnings for certain issues, including superfluous # semicolons and commas, and the use of long long. -fpermissive seems # to be the workaround. - SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wshadow -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused) + SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused) + + IF(${CMAKE_MAJOR_VERSION} GREATER 2 AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9) + SET(OSG_AGGRESSIVE_WARNING_FLAGS ${OSG_AGGRESSIVE_WARNING_FLAGS} -Wshadow) + ENDIF() # Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors