[cmake-developers] set(CACHE) and the local scope
Brad King
brad.king at kitware.com
Thu Dec 10 15:26:54 EST 2015
On 12/10/2015 03:20 PM, Alexander Neundorf wrote:
>> set(var ON)
>> option(var "description" OFF)
>> message("var: ${var}")
>
> I.e. on the first run it would be OFF (since that's the default value
> of the option), and all later runs it would have the value which is in the cache.
This is calling for the opposite change than Ben's proposal. Ben
suggests never unsetting the local value to expose the cached value.
Alex is suggesting always doing so, even if the cache option is
not created by the command.
Alternatively the option() or set(CACHE) commands could also set
a local variable to the same value as the cache entry.
This is pretty fundamental behavior so if we are going to mess with
it through a policy we better get it right.
-Brad
More information about the cmake-developers
mailing list