On 19.07.2015 16:39, Yaron Cohen-Tal wrote:
I want to set "FOO" to "TRUE" iff both "COND_A" and "COND_B" are
true.I tried the following:
set (FOO (${COND_A} AND ${COND_B}))
The AND operator is handled and implemented by the if() and while()
commands and hence not available elsewhere.
but then FOO get's a value like "(;TRUE;AND;TRUE;)" instead of "TRUE".
So I had to write instead:
if (${COND_A} AND ${COND_B})
set (FOO TRUE)
else ()
set (FOO FALSE)
endif ()
Is there a better way?
Depending on context you might omit the else() block given that if(FOO)
will evaluate false if FOO is not a defined variable.
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