[Cmake] Adding flags to CMAKE_CXX_FLAGS
Bill Hoffman
bill.hoffman at kitware.com
Wed Jul 24 09:07:07 EDT 2002
That should work, but it will not show up in the cache.
The changed value will show up in the generated project
files. It is not possible to change cache values from
a CMakeLists file. If you could, then the editors would
not be able to change the values, because each time
cmake was run, they would get reset. So cache values can
only be initialized from the CMakeLists files.
You can change flags in memory when cmake is running,
doing just what you did.
I just tried it with the current release and it works:
grep foo *
CMakeLists.txt: SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /foobar")
Hello.dsp:# ADD CPP /W3 /Zm1000 /GX /GR /foobar
Hello.dsp:# ADD CPP /W3 /Zm1000 /GX /GR /foobar
Hello.dsp:# ADD CPP /W3 /Zm1000 /GX /GR /foobar
Hello.dsp:# ADD CPP /W3 /Zm1000 /GX /GR /foobar
But you can see that in the cache the value is unchanged:
bash-2.05$ grep CXX_FLAGS *
CMakeCache.txt:CMAKE_CXX_FLAGS:STRING=/W3 /Zm1000 /GX /GR
-Bill
At 12:13 PM 7/24/2002 +0100, Daniel Rueckert wrote:
>Hi,
>
>I am trying to add some flags to the MS VC++ compiler under windows
>using a statement like:
>
>IF (WIN32)
> SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /TP /Ze")
>ENDIF (WIN32)
>
>Unfortunately, this doesn't seem to work. Is there any workaround
>this?
>
>Thanks, Daniel
>--
>Daniel Rueckert, Ph.D.
>Visual Information Processing (VIP)
>Dept of Computing, Imperial College
>180 Queens' Gate Tel: +44 20 7594 8333
>London SW7 2BZ Fax: +44 20 7581 8024
>mailto:D.Rueckert at doc.ic.ac.uk http://vip.doc.ic.ac.uk/~dr
>
>_______________________________________________
>Cmake mailing list
>Cmake at public.kitware.com
>http://public.kitware.com/mailman/listinfo/cmake
More information about the CMake
mailing list