[CMake] Setting CMAKE_CXX_FLAGS_<> in CMakeLists.txt
Michael Hammer
michael.hammer at tugraz.at
Sun Jun 24 11:14:58 EDT 2007
Hi!
I have a problem with setting compiler flags. I would like to change
the default debug flags to "-g3 -Wall --pedantic" or at least create
a new build type to use my needed compiler flags. I found an info in
the wiki (http://www.cmake.org/Wiki/CMake_Useful_Variables) and tried
the following statement in CMakeLists.txt in the project root:
SET(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall --pedantic")
But even in the first run (with empty build directory) no change of
this variable in the CmakeCache happened. The entry was still:
---
//Flags used by the compiler during debug builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
---
So I thought let's try to create a new build type, I added the
following lines, again in the root CMakeLists.txt:
---
SET(CMAKE_BUILD_TYPE devel)
SET(CMAKE_CXX_FLAGS_DEVEL "-g3 -Wall --pedantic")
---
The same effect her - nothing! *grml* There was no new variable named
CMAKE_CXX_FLAGS_DEVEL as I would expect it. (Again after creating a
new CMakeCache) May be anyone could help me with this problem? I am
sure I am understanding something wrong about variables which are
changeable in configure process and those which aren't. But I am also
sure there must be a way to write CMakeLists.txt code to configure
compiler flags. Now I am forced to edit the CMakeCache manually and I
have to change the CMAKE_CXX_FLAGS_DEBUG variable each time I create
a new build tree ...
Thanks for any help,
Michael
----------------------------------------------------------------------
__
Dipl.-Ing. (MSc) Michael Hammer (Scientific Assistant) __ _| |_
Institute for Strength of Materials / | || |
Graz University of Technology |_ _||__|
phone: +43 (0) 316 873 / 7667 |__|
fax: +43 (0) 316 873 / 7169
http://www.fest.TUGraz.at/ michael.hammer at tugraz.at
----------------------------------------------------------------------
More information about the CMake
mailing list