[CMake] lexical scoping

Juan Sanchez Juan.Sanchez at amd.com
Fri Nov 2 16:22:53 EDT 2007


My suggestion as a temporary work around would be to apply a namespace
prefix to the variables in your macro.

Create the macro with short variable names x.
Test
Replace variable names with uniques ones MACRO_DOIT_x
Release

If included in another file, your users don't have to see the munged
code underneath.

Juan

Brandon Van Every wrote:
> On Nov 2, 2007 4:13 PM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
>> Brandon Van Every wrote:
>>> On Nov 2, 2007 3:44 PM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
>>>> I have an idea.  What if we created a variable_scope command?
>>> Bad markerting idea.  Nobody programs in this idiom.  (Well, I don't
>>> know about Perl, as far as I'm concerned they're nobody.  ;-)  Lotsa
>>> people program with functions and would expect a scripting language to
>>> have functions.  Minimize the number of "CMake specific weird things"
>>> people have to learn, if you want more users.  SETLOCAL is not so
>>> objectionable, didn't some Unix shells have this historically?
>>>
>> The problem is what does SETLOCAL mean?   There is no scope in cmake
>> right now.  So, I guess you are saying add functions.
> 
> Yep.
> 
>> I am not even
>> sure what those will be...  Many languages have the idea of scope.
>> Braces in C++.   This would just be a way of creating scope.
> 
> Then add braces.  Not some begin_long_thing_word end_long_thing_word.
> Nobody does that, nobody will like it.
> 
> 
> Cheers,
> Brandon Van Every
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
> 
> 


-- 
Juan Sanchez
Juan.Sanchez at amd.com
800-538-8450 Ext. 54395
512-602-4395




More information about the CMake mailing list