Browse Source

BUG: Update CMakeLists.txt to use cmake function ctkFunctionCheckCompilerFlags

Specific g++ flags are now checked to make sure they are
supported on the platform being used.

That should solve the issue happening on Mac with g++ 4.0.1
See http://www.cdash.org/CDash/viewBuildError.php?buildid=639114
Jean-Christophe Fillion-Robin 15 years ago
parent
commit
c2b15303ad
1 changed files with 5 additions and 2 deletions
  1. 5 2
      CMakeLists.txt

+ 5 - 2
CMakeLists.txt

@@ -150,6 +150,7 @@ INCLUDE(CMake/ctkFunctionGenerateDGraphInput.cmake)
 INCLUDE(CMake/ctkFunctionGenerateProjectXml.cmake)
 INCLUDE(CMake/ctkMacroGeneratePluginManifest.cmake)
 INCLUDE(CMake/ctkMacroGeneratePluginResourceFile.cmake)
+INCLUDE(CMake/ctkFunctionCheckCompilerFlags.cmake)
 
 # Used by CTKGenerateCTKConfig.cmake
 SET(CTK_CMAKE_DIR ${CTK_SOURCE_DIR}/CMake)
@@ -228,7 +229,7 @@ ENDIF()
 #
 IF(WITH_COVERAGE)
   IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
-    SET(coverage_flags "-g -fdiagnostics-show-option -fprofile-arcs -ftest-coverage -O3 -DNDEBUG")
+    SET(coverage_flags "-g -fprofile-arcs -ftest-coverage -O3 -DNDEBUG")
     SET(COVERAGE_CXX_FLAGS ${coverage_flags})
     SET(COVERAGE_C_FLAGS ${coverage_flags})
   ENDIF()
@@ -241,7 +242,9 @@ SET(CTK_C_FLAGS "${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}")
 SET(CTK_CXX_FLAGS "${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}")
 
 IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
-  SET(cflags "-fdiagnostics-show-option -Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -fstack-protector-all -D_FORTIFY_SOURCE=2")
+  SET(cflags "-Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -D_FORTIFY_SOURCE=2")
+  ctkFunctionCheckCompilerFlags("-fdiagnostics-show-option" cflags)
+  ctkFunctionCheckCompilerFlags("-fstack-protector-all" cflags)
   SET(CTK_C_FLAGS "${cflags} ${CTK_C_FLAGS}")
   SET(CTK_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo ${CTK_CXX_FLAGS}")
 ENDIF()