On Wednesday 06 July 2011, Jerry Gagelman wrote: > 2011/7/6 Alexander Neundorf <a.neundorf-w...@gmx.net> > > > On Wednesday 06 July 2011, Jerry Gagelman wrote: > > > > If these variables exist already in the cache, then a simple > > set(... CACHE ...) > > does not override the value which is already in the cache. > > You can only override a value in the cache from a CMakeLists.txt by using > > set(... CACHE... FORCE) > > This will put the given value always in the cache. Which also means if > > the user changes the value using "make edit_cache", the set(...CACHE ... > > FORCE) will override his changes again. > > > > Is this the behaviour you are seeing ? > > Thanks. That is the behavior I'm seeing. But it's still not satisfactory. > Is it not possible to "initialize" variables in the cache with values > using the set() command? > > I just tried the following, ignoring the cache altogether: > > set( CMAKE_C_FLAGS_DEBUG "-Wall -Wno-format -g -DDEBUG" ) > set( CMAKE_C_FLAGS_RELEASE "-Wall -Wno-unknown-pragmas -Wno-format -O3" )
Should work. Are you sure there is not typo ? > I rebuilt everything, ensured that the CMAKE_BUILD_TYPE variable in the > cache is set to "Debug," I'm not quite sure about case-sensitivity here, would have to check. Does it work if you set the buildtype tp "DEBUG" instead of "Debug" ? > and built the library using verbose Makefiles. The > compilation commands don't include the extra CMAKE_C_FLAGS_DEBUG flags as > directed. > > I even tried it without quotes around the flag strings. > > Evidently the cache is overriding commands in CMakeLists.txt. No, it's not. Non-cache variables basically shadow the cache variables. You know that the variables above are for C, and there is the same set of variables also for C++ ? CMAKE_CXX_FLAGS_DEBUG etc. Could it be that you have a C++ project and you did set only the C variables ? Alex _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake