<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"><<a href="mailto:eike@sf-mail.de" target="_blank">eike@sf-mail.de</a>></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">> See following example:<br>
><br>
> $ cmake --version<br>
> cmake version 2.8.11.2<br>
> $ cat CMakeLists.txt<br>
> cmake_minimum_required(VERSION 2.8)<br>
><br>
> FUNCTION(foo)<br>
> list(LENGTH ARGV argc)<br>
> message("ARGC=${ARGC} list(LENGTH ARGV)=${argc}")<br>
><br>
> list(GET ARGV 0 argv0)<br>
> message("ARGV0=${ARGV0} list(GET ARGV 0)=${argv0}")<br>
> ENDFUNCTION()<br>
><br>
> foo("a;b;c")<br>
> $ cmake .<br>
> ARGC=1 list(LENGTH ARGV)=3<br>
> ARGV0=a;b;c list(GET ARGV 0)=a<br>
> -- Configuring done<br>
> -- Generating done<br>
> -- Build files have been written to: /root/tmp<br>
> $<br>
><br>
> I know ';' is special in cmake but it's counter-intuitive that ARGC !=<br>
> list(LENGTH ARGV). Is this a bug?<br>
<br>
</div></div>CMake will not expand a string into a list when passed as arguments. It would<br>
do when using a variable:<br>
<br>
set(foovar "a;b;c")<br>
foo(${foovar})<br></blockquote><div><br></div><div>It's not quite about using a variable or not. For your example, foo("${foovar}") would give the same result as mine.<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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>