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)


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to