]> Creatis software - clitk.git/commitdiff
Fix for old versions of gcc
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Mon, 1 Oct 2012 14:44:05 +0000 (16:44 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Mon, 1 Oct 2012 14:44:05 +0000 (16:44 +0200)
cmake/FindGengetopt.cmake

index 78098f9955cac54aa79085ac5eaceb46c8760be4..95f2a474897059f2a7248f1b80267c053b84c268 100644 (file)
@@ -33,6 +33,10 @@ MACRO (WRAP_GGO GGO_SRCS)
   ENDFOREACH(GGO_FILE)
   SET_SOURCE_FILES_PROPERTIES(${${GGO_SRCS}} PROPERTIES GENERATED TRUE)
   IF(CMAKE_COMPILER_IS_GNUCXX)
-    SET_SOURCE_FILES_PROPERTIES(${${GGO_SRCS}} PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
+    FIND_PROGRAM(DEFAULT_GCC gcc)
+    EXEC_PROGRAM(${DEFAULT_GCC} ARGS "-dumpversion" OUTPUT_VARIABLE GCCVER)
+    IF("${GCCVER}" VERSION_GREATER "4.5.2")
+      SET_SOURCE_FILES_PROPERTIES(${${GGO_SRCS}} PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
+    ENDIF("${GCCVER}" VERSION_GREATER "4.5.2")
   ENDIF(CMAKE_COMPILER_IS_GNUCXX)
 ENDMACRO (WRAP_GGO)