[CMake] Concatenating lists back to string

Domen Vrankar domen.vrankar at gmail.com
Thu Oct 23 10:25:26 EDT 2014


2014-10-23 16:05 GMT+02:00 Petr Kmoch <petr.kmoch at gmail.com>:

> Hi Domen.
>
> This is what helps me reason about it:
>
> A string with a ';' in it is a list.
> An unqouted ';' separates arguments to CMake commands.
> string(REPLACE ...) simply concatenates all of its 'input' parameters.
>
> So, when you expand ${list_1} in the last line, it will simply replace in
> the concatenation of its elements - so there's no semicolon in them, of
> course. What you want to do is treat the entire list_1 as a single string:
>
> string(REPLACE ";" "." str_2 "${list_1}")
>
> This should do what you expect.
>

Haven't thought about that... Now it works :) Thanks!

Domen


>
> Petr
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141023/8db8cf6b/attachment.html>


More information about the CMake mailing list