<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"><<a href="mailto:johannes.zarl@jku.at" target="_blank">johannes.zarl@jku.at</a>></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>
> > The "IN LISTS" signature of foreach seems to do additional list<br>
> > splitting, leading to ("foo;bar" "baz") appearing as 3 elements.<br>
> > Accessing the ARGV array by the positional indices (e.g. ${ARGV0})<br>
> > prevents the splitting.<br>
><br>
> Really? That... is surprising. I thought the whole point of 'IN LISTS'<br>
> was to take a variable that already contains a list and NOT do<br>
> additional splitting (the way 'foreach(NAME ${LIST})' 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: "foo;bar" and "baz"<br>
2) The ARGV list is created by adding the parameters to the list:<br>
set(ARGV)<br>
list(ADD ARGV "foo;bar") # here the "foo;bar" list is flattened<br>
list(ADD ARGV "baz")<br>
Since a list cannot contain another list, we get a flattened representation<br>
of the arguments: ARGV == "foo;bar;baz"<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'm using CMake more and more I find it's not a real serious "language". It'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>