On Tue, Oct 15, 2013 at 8:12 PM, Johannes Zarl <[email protected]> wrote:

> On Monday, 14. October 2013, 19:07:06, Matthew Woehlke wrote:
> > > The "IN LISTS" signature of foreach seems to do additional list
> > > splitting, leading to ("foo;bar" "baz") appearing as 3 elements.
> > > Accessing the ARGV array by the positional indices (e.g. ${ARGV0})
> > > prevents the splitting.
> >
> > Really? That... is surprising. I thought the whole point of 'IN LISTS'
> > was to take a variable that already contains a list and NOT do
> > additional splitting (the way 'foreach(NAME ${LIST})' would)...
>
> While the behaviour here is hardly what one would expect, the list is not
> really split.
>
> What happens, is the following:
>  1) Function info gets two parameters: "foo;bar" and "baz"
>  2) The ARGV list is created by adding the parameters to the list:
>     set(ARGV)
>     list(ADD ARGV "foo;bar") # here the "foo;bar" list is flattened
>     list(ADD ARGV "baz")
>  Since a list cannot contain another list, we get a flattened
> representation
>  of  the arguments: ARGV == "foo;bar;baz"
>  3) foreach(name IN LISTS ARGV) only gets to see the flattened
> representation
>  contained in ARGV.
>

When I'm using CMake more and more I find it's not a real serious
"language". It's so tricky.

>
>   Johannes
> --
>
> 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
>
--

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