[CMake] How to assign a boolean expression to a variable?

Yaron Cohen-Tal yaronct at gmail.com
Sun Jul 19 10:39:18 EDT 2015


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}))

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?

Thanx,
Yaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150719/90855ad2/attachment.html>


More information about the CMake mailing list