[CMake] A function and its arguments
Nils Gladitz
nilsgladitz at gmail.com
Sun Feb 28 16:12:32 EST 2016
On 28.02.2016 21:57, Kristian wrote:
> [...]
>
> ************************************
> test_me(1 2 3)
> ************************************
>
> Then I get this output:
>
> ************************************
> test_me
> -> 1
> -> 2
> -> Number of arguments: 3
> -> All arguments: 123
> -> 0. argument: 1
> -> 1. argument: 2
> -> 2. argument: 3
> -> Unexpected arguments: 3
>
> ************************************
>
> I would expect, that the line "All arguments" would look like "All
> arguments: 1 2 3", and not "All arguments: 123".
>
> What is the thought behind this behaviour?
This is due to how you call message() which concatenates its arguments.
Instead try e.g.
message(" -> All arguments: ${ARGV}")
Which should output " -> All arguments: 1;2;3" (CMake's internal list
separator is semicolon).
Nils
More information about the CMake
mailing list