<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 11, 2013 at 2:20 PM, Rolf Eike Beer <span dir="ltr">&lt;<a href="mailto:eike@sf-mail.de" target="_blank">eike@sf-mail.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 Freitag, 11. Oktober 2013, 12:07:58 schrieb Clark WANG:<br>
<div><div class="h5">&gt; See following example:<br>
&gt;<br>
&gt;     $ cmake --version<br>
&gt;     cmake version 2.8.11.2<br>
&gt;     $ cat CMakeLists.txt<br>
&gt;     cmake_minimum_required(VERSION 2.8)<br>
&gt;<br>
&gt;     FUNCTION(foo)<br>
&gt;         list(LENGTH ARGV argc)<br>
&gt;         message(&quot;ARGC=${ARGC} list(LENGTH ARGV)=${argc}&quot;)<br>
&gt;<br>
&gt;         list(GET ARGV 0 argv0)<br>
&gt;         message(&quot;ARGV0=${ARGV0} list(GET ARGV 0)=${argv0}&quot;)<br>
&gt;     ENDFUNCTION()<br>
&gt;<br>
&gt;     foo(&quot;a;b;c&quot;)<br>
&gt;     $ cmake .<br>
&gt;     ARGC=1 list(LENGTH ARGV)=3<br>
&gt;     ARGV0=a;b;c list(GET ARGV 0)=a<br>
&gt;     -- Configuring done<br>
&gt;     -- Generating done<br>
&gt;     -- Build files have been written to: /root/tmp<br>
&gt;     $<br>
&gt;<br>
&gt; I know &#39;;&#39; is special in cmake but it&#39;s counter-intuitive that ARGC !=<br>
&gt; list(LENGTH ARGV). Is this a bug?<br>
<br>
</div></div>CMake will not expand a string into a list when passed as arguments. </blockquote><div><br></div><div>Yes I know this. But after the literal string is passed to the function, it is broken into a list (ARGV). And the ARGC value is not consistent with the length of of ARGV which I&#39;ve never seen in other languages. And this behavior makes it difficult to pass parameters around between cmake functions.<br>

</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It would<br>
do when using a variable:<br>
<br>
    set(foovar &quot;a;b;c&quot;)<br>
    foo(${foovar})<br>
<br>
ARGC=3 list(LENGTH ARGV)=3<br>
ARGV0=a list(GET ARGV 0)=a<br>
<span class="HOEnZb"><font color="#888888"><br>
Eike</font></span><br>--<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></blockquote></div><br></div></div>