[CMake] Re: function and raise_scope commands (+ unset bug)
Filipe Sousa
natros at gmail.com
Sat Feb 16 16:07:13 EST 2008
Sebastien BARRE wrote:
> OK, back to PARENT_SCOPE. Well, Tcl/Tk has 'upvar' (which RAISE_SCOPE
> was inspired from), *and* 'global', which would pretty much declare
> variables inside a procedure/function to be of the "global scope"
> nature. I don't really like any of them. If I had to give a (crazy)
> suggestion though, before 2.6, is that SET would introspect its
> parameters a little more, i.e. before expansion. If the variable to
> be set is a regular variable name (say, SET(bar ..), then it is set
> at the current scope (i.e. local scope for a function). If it is a
> *deferenced* variable (i.e. SET(${bar}), then it should be set in the
> parent scope automatically, *eventually* at the global scope,
> *ideally* propagated back from parent scope to parent scope to the
> scope this "pointer to a variable" was first invoked (i.e. where I
> called SET_VAR2(foo), in my example).
Couldn't we use some kind of variable decorator to indicate that the
variable should be set at the parent scope? As an example:
FUNCTION(SET_VAR1 @varname)
SET(varname "")
ENDFUNCTION(SET_VAR1)
FUNCTION(SET_VAR2 @varname)
SET_VAR1(varname)
ENDFUNCTION(SET_VAR2)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20080216/4fe9084e/signature.pgp
More information about the CMake
mailing list