[CMake] Reverse logic
Rob McDonald
rob.a.mcdonald at gmail.com
Wed Jan 29 19:09:46 EST 2014
I feel like this is a really dumb question, but I've got myself wrapped
around the axel....
I'd like to use a negative conditional on a variable that may or may not be
defined... say USE_SYSTEM_FOO
So, I'd like to do something like this...
IF( NOT ${USE_SYSTEM_FOO} )
# Build my own FOO
ENDIF()
However, this does not work as desired. On the other hand, the following
version does have the desired behavior (shouldn't these be the same?).
IF( ${USE_SYSTEM_FOO} )
ELSE()
# Build my own FOO
ENDIF()
I tried a couple of combinations with DEFINED thrown in. They didn't work
as desired either. I didn't chase after a compound conditional like the
following simply due to ugliness....
IF( NOT DEFINED ${USE_SYSTEM_FOO} OR NOT ${USE_SYSTEM_FOO} )
# Build my own FOO
ENDIF()
What is the CMake idiomatic way to do this?
BTW, I'm going to do a bunch of these, and I'd like to surround them with a
global USE_SYSTEM_LIBRARIES, so solutions that don't get exponentially
uglier with linear increases in complexity are desired.
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140129/1fb8b980/attachment.html>
More information about the CMake
mailing list