[CMake] disabling the cache

Philip Lowman philip at yhbt.com
Fri Nov 2 09:46:21 EDT 2007


Jesper Eskilson wrote:
> Bill Hoffman wrote:
> 
>> For this case, you could have something like this:
>>
>> # if SOME_PROGRAM has a value but the program has been moved
>> # or removed from the system, then clear the cache entry
>> # so that find_program will try again.
>> if(SOME_PROGRAM AND NOT EXISTS ${SOME_PROGRAM})
>>   set(SOME_PROGRAM NOTFOUND CACHE FORCE "some program")
>> endif(SOME_PROGRAM AND NOT EXISTS ${SOME_PROGRAM})
>> find_program(SOME_PROGRAM myprog)
>>
>> So, if you know that you are changing a cmakelist file in a way that
>> requires something to be removed from the cache, just remove it, but
>> be careful not to remove it all the time.
> 
> Ouch. My cmake files are unreadable enough without an added 3 lines here
> and there checking if the cache entry needs to be replaced or not.
> 
> BTW: Are there any plans of fixing the broken regeneration for Visual
> Studio? Or at least documenting it as known problem? As it is now, the
> project files are regenerated but not reloaded, and there is no feedback
> that the new project files aren't used for the build.
> 

And a related note here is Visual Studio's inability to detect that
preprocessor definitions or dependent libraries have changed in a VCproj
file and rebuild or relink the target accordingly.

I've always wondered if CMake could solve this limitation of Visual
Studio by removing object files and/or generated libraries to
effectively force Visual Studio to rebuild or relink the code using the
new settings.

-- 
Philip Lowman
Sr. Simulation Development Engineer, Modeling and Simulation Technology
General Dynamics Land Systems
http://www.gdls.com



More information about the CMake mailing list