[CMake] disabling the cache

Jesper Eskilson jesper at eskilson.se
Wed Oct 31 16:37:04 EDT 2007


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.

-- 
/Jesper



More information about the CMake mailing list