[Cmake] Ad: Strange behavior of FIND_PROGRAM

David Svoboda xsvobod2 at informatics.muni.cz
Fri, 5 Mar 2004 11:48:30 +0100


On Wed, 3 Mar 2004, Brad King wrote:

> David Svoboda wrote:
>
> > To explain the problem better:
> >
> > If you set some cache variable, say MY_PROGRAM to the value
> > C:\bin\beep.exe, by hand in GUI and then you use SET(MY_PROGRAM "NOTFOUND"
> > CACHE FILEPATH "" FORCE), be sure, that this value is stored in
> > CMakeCache.txt and somewhere else!!?
> >
> > Now, if you run CMake command
> >
> > FIND_PROGRAM(MY_PROGRAM	NAMES myprog)
> >
> > without advising any paths, the Windows CMake finds the previous value,
> > i.e C:\bin\beep.exe. You can set some paths in FIND_PROGRAM command, but
> > it does not matter - CMake does not take care about it - the previous
> > value, that is stored somewhere in the memory, is prime.
> >
> >
> > The only solution I found is to exit CMake (memory is flushed) and run it
> > again :-(
>
> The FIND_PROGRAM command's first argument names a CMake cache entry.  If
> the entry is already set to something other than NOTFOUND, it does
> nothing.  The cache is stored in CMakeCache.txt at the top of the build
> tree between runs of CMake.  It is stored in memory while CMake is
> running.  The value in the cache is always preferred because it is
> assumed that the user has seen the value in the GUI and accepted it.  If
> you want to run the search again, remove the entry from the cache (using
> the delete option in the GUI).  The next time the configure phase runs,
> the search will run again.

Well, I don't think it is true every time. If I delete the variable (using
delete option in GUI), it behaves in the same manner I mentioned. The
value is stored somewhere in the memory, so the deletion the cache value
doesn't change anything.

- David


* (Everything was tested on Windows 2000 - CMake v 1.8.3)