<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 15, 2013 at 8:12 PM, Johannes Zarl <span dir="ltr">&lt;<a href="mailto:johannes.zarl@jku.at" target="_blank">johannes.zarl@jku.at</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Monday, 14. October 2013, 19:07:06, Matthew Woehlke wrote:<br>
&gt; &gt; The &quot;IN LISTS&quot; signature of foreach seems to do additional list<br>
&gt; &gt; splitting, leading to (&quot;foo;bar&quot; &quot;baz&quot;) appearing as 3 elements.<br>
&gt; &gt; Accessing the ARGV array by the positional indices (e.g. ${ARGV0})<br>
&gt; &gt; prevents the splitting.<br>
&gt;<br>
&gt; Really? That... is surprising. I thought the whole point of &#39;IN LISTS&#39;<br>
&gt; was to take a variable that already contains a list and NOT do<br>
&gt; additional splitting (the way &#39;foreach(NAME ${LIST})&#39; would)...<br>
<br>
</div>While the behaviour here is hardly what one would expect, the list is not<br>
really split.<br>
<br>
What happens, is the following:<br>
 1) Function info gets two parameters: &quot;foo;bar&quot; and &quot;baz&quot;<br>
 2) The ARGV list is created by adding the parameters to the list:<br>
    set(ARGV)<br>
    list(ADD ARGV &quot;foo;bar&quot;) # here the &quot;foo;bar&quot; list is flattened<br>
    list(ADD ARGV &quot;baz&quot;)<br>
 Since a list cannot contain another list, we get a flattened representation<br>
 of  the arguments: ARGV == &quot;foo;bar;baz&quot;<br>
 3) foreach(name IN LISTS ARGV) only gets to see the flattened representation<br>
 contained in ARGV.<br></blockquote><div><br></div><div>When I&#39;m using CMake more and more I find it&#39;s not a real serious &quot;language&quot;. It&#39;s so tricky.<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<span><font color="#888888"><br>
  Johannes<br>
</font></span><div><div>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</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>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</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>
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></div></div>