[CMake] ; list

Nils Gladitz nilsgladitz at gmail.com
Thu Sep 21 09:35:13 EDT 2017


On Thu, Sep 21, 2017 at 3:26 PM, Patrick Welche <prlw1 at cam.ac.uk> wrote:

> Having run cmake 3.9.2 once already, I see:
>
> $ cat CMakeLists.txt
> set(var one two)
> message(${var})
> $ cmake .
> onetwo
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /tmp/cmaketest
>
> Would you have expected "one;two" rather than "onetwo"?
>

When unquoted each list items is turned into a distinct argument for the
message() invocation.
message() concatenates its arguments hence "onetwo".

To preserve the semicolon in the message try message("${var}")

Nils
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170921/7ace7560/attachment-0001.html>


More information about the CMake mailing list