[CMake] disabling the cache

Alexander Neundorf a.neundorf-work at gmx.net
Thu Nov 1 05:05:22 EDT 2007


On Wednesday 31 October 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.

With cmake cvs you could run "cmake -USOME_PROGRAM <dir>" which would remove 
the variable SOME_PROGRAM from the cache first and then run cmake.
But I guess that's no acceptable solution for MSVC users.


> 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.

I really think this should be filed as a bug report/support issue/whatever the 
right way is to MS, so that they at least know about that (no matter whether 
they will find it worthwhile to fix something which will help writing 
portable software).

Alex


More information about the CMake mailing list