[CMake] lexical scoping

Brandon Van Every bvanevery at gmail.com
Sat Nov 3 11:31:41 EDT 2007


On Nov 3, 2007 10:42 AM, David Cole <david.cole at kitware.com> wrote:
> After all the discussion / suggestions that have been part of this thread, I
> like the following best:
>
> local(scope_name)
>   set(var1 "value1")
>   set(var2 "value2")
> endlocal(scope_name)

> - any SET within the local scope would made only in the local scope unless
> the "CACHE" arg is used

It does have the advantage that I won't be forgetting to put variable
names in a list.

I'm a little puzzled about CACHE.  The conversion scripts I'm writing
don't even have a cache, they're executed with cmake -P.

> - perhaps a "PARENT_SCOPE" keyword could be used with SET to set something
> back out in the containing scope

Somehow I really hate this nomenclature.  Feels tedious.

> - function would be identical to macro except it would have an implied
> "local"/"endlocal" with the scope_name the same as the function name

Except of course we need to be able to SET the arguments.


Cheers,
Brandon Van Every


More information about the CMake mailing list