[Cmake] how to detect a macro

John Biddiscombe john.biddiscombe at mirada-solutions.com
Thu May 15 03:50:20 EDT 2003


If one does

MACRO(MyMacro p1 p2 p3)
  do stuff here
ENDMACRO(MyMacro)

...

later I want to do

IF (MyMacro)
  MyMAcro("1" "2" "3")
ENDIF (MyMacro)

But it never executes because IF(macroname) always returns false. I need to put a macro in an INCLUDE(OPTIONAL) file, and conditionally execute it in another.

Is there a way to detect it's presence (apart from the slightly Klunky
 SET(MYMACROPRESENT 1)
in the optional file

and 
IF (MYMACROPRESENT)
  MyMAcro("1" "2" "3")
ENDIF (MYMACROPRESENT)

thanks

JB



More information about the CMake mailing list