[Cmake] CMake SET + CMakeCache.txt

Bill Hoffman bill.hoffman at kitware.com
Tue Apr 8 10:23:26 EDT 2003


This is somewhat of a problem.   Users running the GUI can
not see what values have been added from the CMakeLists.txt files.
You can FORCE set a cache value, and it will show up in the cache,
however, if that is done, then users will NEVER be able to change
the cache value.   Every time cmake is run, it will force the value
back to what is in the CMakeLists.txt file.    If you append, then
each time you run, it will be appended again and again.

I guess you could use a MATCH IF statement with a SET( CACHE FORCE)
to make sure it was only added if it was not there.   However, this
could still be strange for users, because if they removed the thing
that you SET with the FORCE, it would come right back after the next
configure.  

In practice, only critical flags should be added from the CMakeLists.txt
files.

-Bill


At 10:04 AM 4/8/2003, Brad King wrote:
>> If I do
>>
>> SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
>>
>> then the ccmake user does not see the new string -Wno-deprecated.  OK,
>> but what if they then decide to put some text on the line themselves
>> with the ccmake GUI interface.
>>
>> Is this new text that they type in appended to what I had set above or
>> does it replace it ?
>
>The setting in the GUI only changes the value in the cache.  When the next
>cmake configure step is done, the value is loaded to initalize the
>corresponding cmake variable.  Then the SET command is invoked and appends
>the flags again.
>
>Each time you hit "c" in the ccmake GUI, a whole new pass through the
>cmake listfiles is executed.  All variable values are re-initialized to
>the values from the cache before the pass begins.
>
>-Brad
>
>_______________________________________________
>Cmake mailing list
>Cmake at public.kitware.com
>http://public.kitware.com/mailman/listinfo/cmake 






More information about the CMake mailing list