Hello,

I noticed that when defining a function, one can access lists as 
arguments using named arguments or ARGV0..ARGVn, but not using ARGV and 
ARGN.

To elaborate, assuming the function list_as_args defined as follows:
function(list_as_arg)
  message(STATUS "${ARGC} arguments, ARGV: ${ARGV}")
  message(STATUS "First argument: ${ARGV0}")
  foreach(_arg ${ARGN})
    message(STATUS "Parsing argument ${_arg}")
  endforeach(_arg)
endfunction(list_as_arg)

... and called with 2 arguments:
list_as_arg("list1a;list1b" "list2a;list2b")

...prints the following:
-- 2 arguments, ARGV: list1a;list1b;list2a;list2b
-- First argument: list1a;list1b
-- Parsing argument list1a
-- Parsing argument list1b
-- Parsing argument list2a
-- Parsing argument list2b

So ARGV0 is not the same as the first argument of ARGV. Why? Is it that 
the ARGV and ARGN lists get flattened, but the ARGVx are assigned before 
that?

How can I safely access the values of ARGN, if they might contain lists?

Thanks,
  Johannes
_______________________________________________
Powered by www.kitware.com

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

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

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

Reply via email to