[CMake] Hiding a variable from the GUI

Bill Hoffman bill.hoffman at kitware.com
Mon Mar 31 14:31:56 EDT 2008


Fernando Cacciola wrote:
> Hi,
> 
> One of my users reported that the filenames of several header files 
> appeared in the advanced section when using CMakeSetup/ccmake. 
> Eventually I tracked down the problem to some macro using find_file.
> It turns out that the variable where find_file (and family) reports the 
> result is automatically cached whether I like or not. My code was using 
> "mark_as_advanced" but that was not enough as my users just didn't want 
> the variable in the GUI at all.
> 
> Eventually I came up with the following trivial macro "mark_as_internal" 
> which I used to hide away these unwanted variables:
> 
> macro ( mark_as_internal _var )
>  set ( ${_var} ${${_var}} CACHE INTERNAL "hide this!" FORCE )
> endmacro( mark_as_internal _var )
> 
> but I wonder:
> 
> Is there a better way?
> 
> Shouldn't ALL the commands that create/define variables (like find_*) 
> accept a NO_CACHE option? or at the very least an INTERNAL option?
> 
> TIA
> 
> 
mark_as_advanced is the usual path.

-Bill



More information about the CMake mailing list