[CMake] if defined and boolean value

Victor Aurélio Santos victoraur.santos at gmail.com
Sat Jul 13 17:54:37 EDT 2013


Hi,

I'm trying to evaluate a expression "if variable X is defined and Y is ON":
tried this:
if (defined ${GETTEXT_LIB-NOTFOUND} and ${ENABLE_NLS})

but doesn't work, obviously  GETTEXT_LIB-NOTFOUND is defined if
find_library can't find 'gettext' and ENABLE_NLS is a option default
to OFF.

"doesn't work":
CMake Error at CMakeLists.txt:20 (if):
  if given arguments:

    "defined" "and" "OFF"

  Unknown arguments specified

Thanks!


More information about the CMake mailing list