← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3734: Add -ftrack-macro-expansion=0, if gcc>=4.8

 

------------------------------------------------------------
revno: 3734
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Tue 2013-10-29 16:16:57 +0100
message:
  Add -ftrack-macro-expansion=0, if gcc>=4.8
  
  See http://bugs.debian.org/726009 for more information
modified:
  CMakeLists.txt


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2013-10-09 05:37:48 +0000
+++ CMakeLists.txt	2013-10-29 15:16:57 +0000
@@ -39,6 +39,19 @@
 INCLUDE(FindPythonModule)
 INCLUDE(GNUInstallDirs)
 #===========================================================
+# HACK!!! If the version of gcc is 4.8 or greater, we add -ftrack-macro-expansion=0 
+# to compiler to reduce the memory consumption during compilation step.
+# See http://bugs.debian.org/726009 for more information
+# Can be removed later, if gcc fixes its regression
+# Taken from http://stackoverflow.com/questions/4058565/check-gcc-minor-in-cmake
+ 
+EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
+IF (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
+  MESSAGE(STATUS "GCC Version >= 4.8. Adding -ftrack-macro-expansion=0")
+  SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -ftrack-macro-expansion=0 ")
+ENDIF()
+
+#===========================================================
 IF (CMAKE_CXX_FLAGS)
   #If flags are set, add only neccessary flags
   IF (DEBUG)