[CMake] Why are blank-delimited strings in commands escaped on Linux?

Claudio Bley b_l_e_y at ml1.net
Fri Oct 2 08:12:16 EDT 2009


Hendrik Sattler <post at hendrik-sattler.de>
writes:

> Zitat von Claudio Bley <b_l_e_y at ml1.net>:
>>> set(a "hello world\\ hello world")
>>> message(STATUS "a = ${a}")
>>> set(a_list ${a})
>>> message(STATUS "a_list = ${a_list}")
>>>
>>> The result is
>>>
>>> -- a = hello world\ hello world
>>> -- a_list = hello world\ hello world
>>
>> So, the real issue here is that your CAIRO_LINK_FLAGS variable just
>> contains a single string, where it should contain a list instead.
>>
>> You should fix that in your OCaml /PLplot module.
>
> He gets that from external tools. They ususally do not provide cmake
> lists.

Ok. Then, he should use separate_arguments:

,----
| separate_arguments(CAIRO_LINK_FLAGS)
`----

> But I think that his example is wrong, it should be:
> set(a "-Lfoo -lbar")
> message(STATUS "a = ${a}")
> set(a_list ${a})
> message(STATUS "a_list = ${a_list}")
>
> Then the result should be
>  -- a = -Lfoo -lbar
>  -- a_list = -Lfoo;-lbar

No, should it not. How should that be possible? ${a} is not a list, it's
a string (ie. it does not contain semi colons).

The output is:

,----
| -- a = -Lfoo -lbar
| -- a_list = -Lfoo -lbar
`----

Regards,
Claudio



More information about the CMake mailing list