[CMake] re-running cmake with different flags doesn't work

Brad King brad.king at kitware.com
Fri Jul 25 11:56:17 EDT 2008


Andreas Pakulat wrote:
> Hi,
> 
> I've just noticed that re-running cmake and changing -DCMAKE_CXX_FLAGS
> doesn't work as one would expect. This claims to be rebuilding the
> makefiles, however after running a make clean and make VERBOSE=1 I don't
> see the flags being applied.
> 
> To make this clear, what I'm doing is:
> 
> cmake ../
> make
> cmake -DCMAKE_CXX_FLAGS=-g ../
> make clean
> make VERBOSE=1
> 
> And the -g flag is not there on the g++ line. Sample CMakeLists.txt:
> 
> ,----
> | add_executable(foo main.cpp)
> `----
> 
> Looking at the cache I can't see the -g flag there - except in the DEBUG
> versions where it always appears.
> 
> Should I file a bugreport?

I just tried this in CMake 2.4 and 2.6 and it works fine.
I can even switch the flags multiple times.

-Brad


More information about the CMake mailing list