[CMake] empty list evaluates to false?
Stuermer, Michael SP/HZA-ZSEP
michael.stuermer at schaeffler.com
Mon Feb 29 09:40:17 EST 2016
You can check for existence of a variable and you can invert the result of the evaluation:
if(DEFINED <varname>)
# called if variable exists, never mind if it's empty or not
endif()
if(NOT DEFINED <varname>)
# called if variable is not defined
endif()
if(NOT <varname>)
# called if variable is empty/false/off
endif()
I think it should be possible to get the expected behavior this way...
best regards,
Michael
> -----Original Message-----
> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of ?? Jan
> Hegewald
> Sent: Monday, February 29, 2016 3:12 PM
> To: cmake at cmake.org
> Subject: [CMake] empty list evaluates to false?
>
> 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
More information about the CMake
mailing list