If you really wanted to pass the name of the variable in rather than the value, then as Rolf says the behaviour you get is as expected.  The only way round that would be to rename var in the function to something guaranteed not to be the name of a variable that you ever tried to pass in.<br>
<br>Or you could use a macro instead:<br><br>MACRO(buildm var)<br>       MESSAGE(STATUS &quot;var: &quot; ${${var}})<br>ENDMACRO()<br><br>SET(var red blue yellow green)<br>buildm(var)<br><br>-- var: redblueyellowgreen<br>
<br>--<br>Glenn<br><br><br><div class="gmail_quote">On 12 May 2011 13:21, Micha Renner <span dir="ltr">&lt;<a href="mailto:Micha.Renner@t-online.de">Micha.Renner@t-online.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Am Donnerstag, den 12.05.2011, 11:50 +0100 schrieb Glenn Coombs:<br>
<div class="im">&gt; I think you probably wanted to write and call your function like this:<br>
&gt;<br>
&gt; FUNCTION(build var)<br>
&gt;        MESSAGE(STATUS &quot;var: ${var}&quot;)<br>
&gt; ENDFUNCTION(build)<br>
&gt;<br>
&gt; SET(var red blue yellow green)<br>
&gt; build(&quot;${var}&quot;)<br>
&gt;<br>
&gt; That prints out as you would expect:<br>
&gt;<br>
&gt; -- var: red;blue;yellow;green<br>
&gt;<br>
</div>Both versions are possible.<br>
My point was, that in the case I described, the name of the parameter of<br>
the function may not be the same as the name of variable the function is<br>
called.<br>
<br>
With your version you don&#39;t have this problem.<br>
Thanks.<br>
<font color="#888888"><br>
Micha<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br>