[CMake] empty list evaluates to false?

Petr Kmoch petr.kmoch at gmail.com
Mon Feb 29 09:27:01 EST 2016


Hi Jan.

No, that's not possible. Internally, CMake does not differentiate between
"list" and "string" in any way. An empty list and an empty string are
indistinguishable. A non-empty string containing N semi-colons is
indistinguishable from a list containing N+1 elements.

Quantum mechanics has wave-particle dualism, CMake has string-list dualism
:-)

Petr

On Mon, Feb 29, 2016 at 3:11 PM, 🐋 Jan Hegewald <jan.hegewald at awi.de>
wrote:

> Hi cmakers,
> can I create an empty list which evaluates to true? The way I tried they
> evaluate to false:
>
> set(BLAS_LIBRARIES "") # trying to create an empty list
> if(BLAS_LIBRARIES)
>         # not called
> endif()
>
> Cheers,
> Jan
> --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160229/b598e36f/attachment.html>


More information about the CMake mailing list