[CMake] How to compare booleans
Rolf Eike Beer
eike at sf-mail.de
Thu Aug 2 18:49:40 EDT 2012
I have 2 variables that hold boolean values. One is the result of a
try_compile() and the other has the expected outcome. Now I want to check if
the expectation is correct, so I tried:
if (_COMPILE_RESULT EQUAL SHOULD_COMPILE)
Which works if both are true or different, but the result is "false" if both
variables are false, too. I played around with expanding the variables or
quoting, but no change. The only way I got the expected result was this:
if (_COMPILE_RESULT EQUAL SHOULD_COMPILE OR (NOT _COMPILE_RESULT) EQUAL (NOT
SHOULD_COMPILE)
This is not really what I would have expected. Is there a less ugly way to get
the expected result?
Eike
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120803/a623c3a8/attachment.pgp>
More information about the CMake
mailing list