[CMake] Re: function and raise_scope commands (+ unset bug)

Brandon Van Every bvanevery at gmail.com
Sun Feb 17 04:42:00 EST 2008


On Feb 16, 2008 3:48 PM, Alexander Neundorf <a.neundorf-work at gmx.net> wrote:
>
> Any opinion whether RAISE_SCOPE/PARENT_SCOPE should propagate to the parent
> directory if it's used outside a function ?

What if I do want a variable to "propagate up" through nested
functions functions, but I don't want any such functions to be passing
info up to a parent directory?  Function scopes and directory scopes
strike me as being orthogonal concepts.  I think it's a very bad idea
to be overloading orthogonal concepts.  It creates corner cases that
frustrate users, and it's not very much like what C/C++ programmers
are used to.  I want scope in CMake, but I don't want it introduced in
such a way that it causes people to hate and curse the language.

PARENT_DIR would be an appropriate keyword if you want to assign
values that the parent directory picks up.  It's much more
self-documenting.  It could be a keyword in addition to PARENT_SCOPE.

I have to admit, PARENT_SCOPE nomenclature bugs me.  I don't know of
any mainstream programming language that explicitly asks me to think
about scope when setting a variable.  It has an extremely clunky
feeling to it.  Even if it turns out to be practical, CMake script
does have an image problem.  Keywords that don't exacerbate it would
be better.  I can't quite think of what PARENT_SCOPE really means to
do, if parent directories are taken out of the equation.  Maybe
because it's almost 5 am.


Cheers,
Brandon Van Every


More information about the CMake mailing list