[CMake] global variable vs cache variable

t m cmake at majchrowski.co.uk
Tue Nov 22 05:51:52 EST 2011


Hi Community,

I could not found any other possibilites to set some global variable
than using a cache variable. Even if this is not nice sometimes you
need to have a global variable.
So I would like to ask about advice in this area:

1) Is this the real use case for cache, so  to use it as a global
variables container. In my understanding this is something that is
intended to use if you would like to save
some values between separate calls of the cmake.

2) Is there any performance issue with using of cache, I/O, etc? What
is better way use PARENT_SCOPE in the loop to forward the variable to
the upper level scope or just CMakeCache.

Looking for advise,
Best regards, T. Majchrowski


More information about the CMake mailing list