On 2013-07-13 17:54, Victor Aurélio Santos wrote:
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})

For FOO not found, FOO-NOTFOUND gets defined? That'd be news to me... (Usually I expect FOO-NOTFOUND to be the value of FOO...)

Besides other comments re: case sensitivty, I'd expect to see a check like this written:

if(NOT GETTEXT_LIB AND ENABLE_NLS)

For the first, I don't know why you'd specifically want to check for 'DEFINED GETTEXT_LIB-NOTFOUND' versus that GETTEXT_LIB is "valid" ('if(FOO)' is false for FOO == FOO-NOTFOUND).

For the second, you probably do not want to expand ENABLE_NLS. Else I can break your build by doing something like '-DON=OFF'. (Granted that will probably make all kinds of problems, but in general I wouldn't expand variables when you want to Boolean-test them, because CMake will try to expand again the result of expansion.)

--
Matthew

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to