I want to modify a variable passed to a function. Here's the code I wrote:
FUNCTION(TEST var)
set(${var} "ABC")
message(${var}) # 2) 123
set(${var} "ABC" PARENT_SCOPE)
ENDFUNCTION(TEST)
set(v "123")
message(${v}) # 1) 123
TEST(${v})
message(${v}) # 3) 123
Why all three outputs print 123. I expected #2 and #3 print ABC?
If I pass variable like this - TEST(v) - I have other output: #1 - 123, #2 - v, #3 - ABC. Why is this? What's the difference?