[CMake] A function and its arguments

Kristian kristianonline28 at gmail.com
Sun Feb 28 17:17:56 EST 2016


You were right. Thank you!

2016-02-28 22:12 GMT+01:00 Nils Gladitz <nilsgladitz at gmail.com>:
> 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