[CMake] remove variable from cache?

r.koebler at yahoo.de r.koebler at yahoo.de
Sat Apr 21 05:34:03 EDT 2007


hi,
> > is there any way to remove a variable from the cache, or alternatively
> > don't show a cached value in ccmake?
> > or can I tell FIND_PATH not to create a cache entry?
> >
> > (this would be i.e. useful in some FindXXX.cmake files, where
> >  several FIND_PATHs are used and all found paths then are
> >  combined in XXX_INCLUDE_DIRS. and it's ugly if both
> >  XXX_INCLUDE_DIRS and all the single paths appear in
> >  ccmake.)
> 
> When using the SET() function, mark the variable as "INTERNAL" and it will not 
> appear in the cmake GUI.
thanks!


but when using SET(var1 ...) in combination with FIND_PATH(var1 ...),
SET causes FIND_PATH not to set var1:

---- CMakeLists.txt:
SET(tmp1 "dummy" CACHE INTERNAL "mydocstring")
FIND_PATH(tmp1 glib.h /usr/include/glib-2.0)
MESSAGE("***tmp1: ${tmp1}")
----
$ cmake ..
***tmp1: dummy 


I now found out, that if you want to hide a FIND_PATH-variable in
the cmake GUI, you have to do it this way:

---- CMakeLists.txt:
FIND_PATH(tmp1 glib.h /usr/include/glib-2.0)
SET(tmp1 ${tmp1} CACHE INTERNAL "mydocstring")

MESSAGE("***tmp1: ${tmp1}")
----
$ cmake ..
***tmp1: /usr/include/glib-2.0


thanks,
Roland



More information about the CMake mailing list