> CMake will not expand a string into a list when passed as arguments. It
> would do when using a variable:
While this is true, it's also not the whole truth (and I guess is that this is
bothering Clark). Consider the following two function calls:
foo1("a;b;c")
foo2("a;b" c)
Of course cmake recognises foo1 as having one parameter, and foo2 as having 2
parameters. And if you do use names arguments in your function, or access the
function arguments by their positional arguments, it works as expected:
function(foo2)
message("Arg0: ${arg0}") # "Arg0: a;b"
message("${ARGC} arguments.") # "2 Arguments."
endfunction()
If, however you try to access the argument list as a whole, you fall in the
"list of lists trap". CMake can not have lists as elements of other lists.
Trying to use the ARGV or ARGN lists in the above example will not achieve
what you are trying to do, because when cmake assembles the list of arguments,
the (for lack of a better word) "list property" is lost:
set(mylist)
list(ADD mylist "a;b")
list(LENGTH mylist n)
message( "length is ${n}") # "length is 2"
Cheers,
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