; list

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

; list

Patrick Welche
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"?

Cheers,

Patrick
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: ; list

Nils Gladitz-2
On Thu, Sep 21, 2017 at 3:26 PM, Patrick Welche <[hidden email]> 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

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: ; list

Haocheng Liu
In reply to this post by Patrick Welche
Hi Patrick,

On Thu, Sep 21, 2017 at 9:26 AM, Patrick Welche <[hidden email]> 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"?

It should be "onetwo".
If you want it to be "one;two", then try
```cmake
message(${"var}") # Use quotes here
``` 
 
Cheers,

Patrick
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



--
Best regards
Haocheng

Haocheng LIU
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: <a href="tel:(518)%20881-4421" value="+15188814443" style="color:rgb(17,85,204);font-size:12.8px" target="_blank">518-881-4421

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: ; list

Patrick Welche
In reply to this post by Nils Gladitz-2
On Thu, Sep 21, 2017 at 03:35:13PM +0200, Nils Gladitz wrote:
> On Thu, Sep 21, 2017 at 3:26 PM, Patrick Welche <[hidden email]> wrote:
> 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}")

Thank you!

Patrick
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake