I asked a questions about cmake and passing variables here. I can make it work, but only if I name my variable in the function differently than the variable in parent scope I call the function for. So in essence:
function(strange name)
message(STATUS ${name})
message(STATUS ${${name}})
endfunction()
set(name foo)
set(anothername foo)
strange(name)
strange(anothername)
Which results in:
-- name (message(STATUS ${name}) for var "name")
-- name (message(STATUS ${${name}}) for var "name")
-- anothername message(STATUS ${name}) for var "anothername")
-- foo (message(STATUS ${${name}}) for var "anothername")
Isn't that a little weird? What's happening? I think the behaviour of a function should not depend on the naming of variable in the parent scope - should it?!
Any clarification is much appreciated!