I have an idea.  What if we created a variable_scope command?

Something like this:

set(a "world")
variable_scope_begin(a)
set(a "hello")
message(${a})
variable_scope_end(a)
message(${a})


The above would print out:
hello
world

This could be done with the current macros, or even an include file of cmake without having to create the idea of a function. You could of course pass in a list of variables to variable_scope. It would be sort of like the "my" in perl. I don't think it would be that hard to implement this, and it would be backwards compatible, and not make the set command any more complicated. You could nest them as well. It could cause some odd things to happen if you forgot to add the scope_end, but it might fix more things than it breaks.

-Bill



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

Reply via email to