A variable is not cached (in CMakeCache.txt) by a SET command unless CACHE
is specified. A cached variable is not changed by a SET command unless FORCE
is used...

See "cmake --help-command SET" for more info....

Setting the CMAKE_CXX_FLAGS_DEBUG even without getting it cached should have
the effect you want however. If you build a .o file with "make VERBOSE=1"
you should see the flags you set being used for the compile...


HTH,
David


On 6/24/07, Michael Hammer <[EMAIL PROTECTED]> wrote:

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/                    [EMAIL PROTECTED]
----------------------------------------------------------------------



_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to