[CMake] //adding and changing compiler flags - best way
"Sören Freudiger"
muffmolch at gmx.de
Sun Nov 9 10:45:44 EST 2008
No idea??? Problem in my solution is: user defined flags via "gui" are vanished at configure...
-----Ursprüngliche Nachricht-----
Von: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] Im Auftrag von Sören Freudiger
Gesendet: Donnerstag, 6. November 2008 19:20
An: cmake at cmake.org
Betreff: [CMake] //adding and changing compiler flags - state of the art?
Hi
long long time ago I wrote this macro to add CXX flax:
#################################################################
### ADD_CXX_FLAGS(flags) ###
### flags will be added to CMAKE_CXX_FLAGS ###
#################################################################
MACRO(ADD_CXX_FLAGS)
FOREACH(arg ${ARGN})
SET(TMP ${arg}) #elsewise the Seperate command doesn't work)
SEPARATE_ARGUMENTS(TMP)
FOREACH(option ${TMP})
STRING(REGEX REPLACE " ${option}" "" CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS}")
STRING(REGEX REPLACE "${option}" "" CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${option}" CACHE STRING
"common C++ build flags" FORCE)
ENDFOREACH(option ${TMP})
ENDFOREACH(arg ${ARGN})
ENDMACRO(ADD_CXX_FLAGS)
And also similar macros for the different build types.
But meanwhile a lot of things changed in cmake and I like to know how others
are handling the flag stuff.
Depending on the used compiler I have e.g. a gcc43.cmake file with common
compiler flags (and one for intel9/10, mscv8/9_32/64).
We don't have time to use the check compiler flag macro at all.
Thus what's the best way to set the flags (avoiding setting them twice, etc.
pp.)?
Shall I use the set_target_properties macro?
Best
-SirAnn
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake
--
GMX Download-Spiele: Preizsturz! Alle Puzzle-Spiele Deluxe über 60% billiger.
http://games.entertainment.gmx.net/de/entertainment/games/download/puzzle/index.html
More information about the CMake
mailing list