as in said in the title, I would like to write a "nice" function in cmake that is able to modify a variable which is passed as a parameter into that function.
The only way I can think of doing it is ugly:
Function definition
function(twice varValue varName)
set(${varName} ${varValue}${varValue} PARENT_SCOPE)
endfunction(twice)
Usage
set(arg foo)
twice(${arg} arg)
message("arg = "${arg})
Result
arg = foofoo
It seems to me, there is no real concept of variables that one can pass around at all?! I feel like there is something fundamental about cmake that I didn't take in yet.
So, is there a nicer way to do this?
Thanks a lot!
I use these two macros for debugging:
Usage:
Output:
You don't need to pass the value and the name of the variable. The name is enough, because you can access the value by the name:
outputs "foofoo"