[CMake] cache variable prevents FIND_LIBRARY to be called again :/

Tristan Carel tristan.carel at gmail.com
Wed Nov 1 16:39:51 EST 2006


On 11/1/06, Tristan Carel <tristan.carel at gmail.com> wrote:
> On 11/1/06, Brad King <brad.king at kitware.com> wrote:
> > Tristan Carel wrote:
> > > Hi,
> > >
> > > The documentation of `FIND_LIBRARY' specify:
> > > "Once one of these calls succeeds the result variable will be set and
> > > stored in the cache so that neither call will search again."
> > >
> > > Is there a way to avoid this behavior? I've got a FIND_LIBRARY whose
> > > search locations depends of the result of a EXECUTE_PROCESS so this
> > > FIND_LIBRARY needs to be performed each time I run `configure'.
> > >
> > > Is there a way to remove an entry from the cache?
> >
> > It doesn't have to be removed from the cache.  The command should just
> > not see the value loaded from it:
> >
> > SET(MYLIB)
> > FIND_LIBRARY(MYLIB ...)
>
> It doesn't seem to work, the cache value is not updated.
>
> Here is more details about my problem.
> --------------------------------------------------
> FIND_EXECUTABLE(PYTHON_EXECUTABLE python)
>
> # store version of PYTHON_EXECUTABLE in `PythonLibs_version'
> EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c ...
>   OUTPUT_VARIABLE PythonLibs_version)
> # ask PYTHON_EXECUTABLE where is the library dir and store it in
> `PythonLibs_libdir'
> EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c ...
>   OUTPUT_VARIABLE PythonLibs_libdir)
> MESSAGE(STATUS "
> PythonLibs_libdir: ${PythonLibs_libdir}
> PythonLibs_version: ${PythonLibs_library_suffix}")
>
> SET(PYTHON_LIBRARIES)
> FIND_LIBRARY(PYTHON_LIBRARIES python${PythonLibs_version}
>   PATHS ${PythonLibs_libdir} NO_DEFAULT_PATH)
> MESSAGE(STATUS "PYTHON_LIBRARIES: ${PYTHON_LIBRARIES}")
> --------------------------------------------------

Ok it works if I set

SET(PYTHON_LIBRARIES PYTHON_LIBRARIES-NOTFOUND)

which is logic!

Thanks to Brad & Alan
-- 
Tristan Carel
Music with dinner is an insult both to the cook and the violinist.


More information about the CMake mailing list