Zachary Pincus wrote:
I'm having some strange issues using the ARGVn variables in macros. Specifically, even when one of those variables has a value, they seem to fail IF tests (and similar).

Perhaps this is best illustrated with an example:
#----------
MACRO(foo)
  IF(ARGV0)
    MESSAGE("ONE ARGUMENT")
  ELSE(ARGV0)
    MESSAGE("NO ARGUMENTS")
  ENDIF(ARGV0)
ENDMACRO(foo)

The ARGV* variables in macros are handled differently from other variables. When the macro is invoked "${ARGV0}" is replaced by the argument passed to the macro. The resulting macro body is then executed. Try this:

MACRO(foo)
  IF("${ARGV0}")
    MESSAGE("ONE ARGUMENT")
  ELSE("${ARGV0}")
    MESSAGE("NO ARGUMENTS")
  ENDIF("${ARGV0}")
ENDMACRO(foo)

-Brad
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to