[CMake] INTERNAL vs. STATIC cache variables

Marcel Loose loose at astron.nl
Mon Sep 28 05:57:51 EDT 2009


On Fri, 2009-09-25 at 21:12 +0200, Alexander Neundorf wrote:
> On Friday 25 September 2009, Marcel Loose wrote:
> > Hi all,
> >
> > Is there a difference in precedence between INTERNAL and STATIC cache
> > variables?
> >
> > For example, what happens if I (accidentally) define an INTERNAL cache
> > variable that is already or will be defined by CMake? Will the STATIC
> > variable always have precedence? Or am I entering the realm of undefined
> > behavior?
> 
> I think this matters only for the GUI, i.e. ccmake and cmake-gui. INTERNAL 
> variables are hidden there.
> 
> Alex

Hi Alex,

I think both INTERNAL and STATIC cache variables are hidden by the GUI.
>From the documentation on set(), I tend to conclude that STATIC cache
variables are use by CMake for storing values it uses internally,
because you cannot set variables of type STATIC.

This conclusion is backed by looking at the CMake source code. E.g.,
cmProjectCommand.cxx writes out the comment "Value Computed by CMake"
for a.o. the cache variables CMAKE_PROJECT_NAME; and cmTarget.cxx writes
out "Dependencies for target" for target dependency information.

My question is: do I risk clobbering these STATIC cache variables when
(accidentally) setting such a variable as INTERNAL? Or does a STATIC
variable always take precedence?

Of course I could just try this out and see what happens. But I don't
want to run the risk that the behavior I find is CMake version-specific.

Best regards,
Marcel Loose.




More information about the CMake mailing list