I have the following code in a script:<br><br><span style="font-family: courier new,monospace;">function(set_var var)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; message(&quot;var = ${var}&quot;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; message(&quot;${var} = ${${var}}&quot;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; set(${var} &quot;new_val&quot;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; message(&quot;${var} = ${${var}}\n&quot;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">endfunction()</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">set(myvar 10)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">set_var(myvar)</span><br style="font-family: courier new,monospace;">
<br><span style="font-family: courier new,monospace;"># Empty variable</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">set_var(myvar2)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">set_var(var)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># Set variable</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">set(var 11)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">set_var(var)</span><br style="font-family: courier new,monospace;">
<br>When I run it I get the following output:<br><br><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">var = myvar</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">myvar = 10</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">myvar = new_val<br><br style="font-family: courier new,monospace;">
</span><span style="font-family: courier new,monospace;">var = myvar2</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">myvar2 = </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">myvar2 = new_val</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><br>var = var</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">var = var</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">new_val = </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"><br>var = var</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">var = var</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">new_val = </span><br style="font-family: courier new,monospace;"><br>I get expected output when the name of the variable I pass in isn&#39;t the same as the one used in the function parameter list.<br>
<br>Is this the desired behavior of the language?&nbsp; I would argue that it isn&#39;t, because you get different behavior based on the name of the variable passed in.<br><br>I&#39;m using CMake 2.6.3R8 on WinXP 64.<br><br>Thanks,<br>
James<br><br><br>