yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11983
[Branch ~yade-pkg/yade/git-trunk] Rev 3633: Simplify definition of build flags
------------------------------------------------------------
revno: 3633
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Thu 2015-04-23 18:06:41 +0200
message:
Simplify definition of build flags
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 2014-12-03 21:07:09 +0000
+++ CMakeLists.txt 2015-04-23 16:06:41 +0000
@@ -41,55 +41,36 @@
INCLUDE(FindLoki)
INCLUDE(FindPythonModule)
INCLUDE(GNUInstallDirs)
+
+INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR})
+
#===========================================================
# HACK!!! If the version of gcc is 4.8 or greater, we add -ftrack-macro-expansion=0
# and -save-temps into compiler to reduce the memory consumption during compilation.
# 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 and -save-temps")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftrack-macro-expansion=0 -save-temps")
+ ADD_DEFINITIONS("-ftrack-macro-expansion=0 -save-temps")
ENDIF()
#===========================================================
IF ("${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" MATCHES ".*clang")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-512")
+ ADD_DEFINITIONS("-ftemplate-depth-512")
ENDIF()
-#===========================================================
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR})
-#===========================================================
-
-#===========================================================
-
-IF (CMAKE_CXX_FLAGS)
- #If flags are set, add only neccessary flags
- IF (DEBUG)
- SET(CMAKE_VERBOSE_MAKEFILE 1)
- SET(CMAKE_BUILD_TYPE Debug)
- ADD_DEFINITIONS("-DYADE_DEBUG")
- ELSE (DEBUG)
- SET(CMAKE_BUILD_TYPE Release)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
- ENDIF (DEBUG)
-ELSE (CMAKE_CXX_FLAGS)
- #If flags are not set, add all useful flags
- IF (DEBUG)
- SET(CMAKE_VERBOSE_MAKEFILE 1)
- SET(CMAKE_BUILD_TYPE Debug)
- ADD_DEFINITIONS("-DYADE_DEBUG")
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -fPIC -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security")
- ELSE (DEBUG)
- SET(CMAKE_BUILD_TYPE Release)
- SET(CMAKE_CXX_FLAGS "-Wall -fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -s")
- ENDIF (DEBUG)
-ENDIF (CMAKE_CXX_FLAGS)
+SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -fPIC -O2 -fstack-protector-strong --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall -std=c++0x")
+
+IF (DEBUG)
+ SET(CMAKE_VERBOSE_MAKEFILE 1)
+ SET(CMAKE_BUILD_TYPE Debug)
+ ADD_DEFINITIONS("-DYADE_DEBUG -g")
+ENDIF (DEBUG)
+
#===========================================================
# Add possibility to use local boost installation (e.g. -DLocalBoost=1.46.1)