Am Freitag, 11. Oktober 2013, 14:49:18 schrieb Clark WANG:
> On Fri, Oct 11, 2013 at 2:20 PM, Rolf Eike Beer <[email protected]> wrote:
> > Am Freitag, 11. Oktober 2013, 12:07:58 schrieb Clark WANG:
> > > See following example:
> > >     $ cmake --version
> > >     cmake version 2.8.11.2
> > >     $ cat CMakeLists.txt
> > >     cmake_minimum_required(VERSION 2.8)
> > >     
> > >     FUNCTION(foo)
> > >     
> > >         list(LENGTH ARGV argc)
> > >         message("ARGC=${ARGC} list(LENGTH ARGV)=${argc}")
> > >         
> > >         list(GET ARGV 0 argv0)
> > >         message("ARGV0=${ARGV0} list(GET ARGV 0)=${argv0}")
> > >     
> > >     ENDFUNCTION()
> > >     
> > >     foo("a;b;c")
> > >     $ cmake .
> > >     ARGC=1 list(LENGTH ARGV)=3
> > >     ARGV0=a;b;c list(GET ARGV 0)=a
> > >     -- Configuring done
> > >     -- Generating done
> > >     -- Build files have been written to: /root/tmp
> > >     $
> > > 
> > > I know ';' is special in cmake but it's counter-intuitive that ARGC !=
> > > list(LENGTH ARGV). Is this a bug?
> > 
> > CMake will not expand a string into a list when passed as arguments. It
> > would
> > 
> > do when using a variable:
> >     set(foovar "a;b;c")
> >     foo(${foovar})
> 
> It's not quite about using a variable or not. For your example,
> foo("${foovar}") would give the same result as mine.

Yes, of course. And that's basically the whole point: by the quotes you tell 
CMake to interpret the stuff as string at this point.

foo(a;b;c)

should give your expected result, too.

Eike
-- 

Attachment: signature.asc
Description: This is a digitally signed message part.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to