[CMake] Test for if a macro defined

Alexander Neundorf a.neundorf-work at gmx.net
Sun Feb 10 16:34:34 EST 2008


On Saturday 09 February 2008, James Bigler wrote:
> Is there an expression similar to the one for variables to determine if a
> macro is defined?
>
> MACRO(TEST)
>    MESSAGE("TEST is defined")
> ENDMACRO(TEST)
>
> IF(DEFINED TEST)
>    TEST()
> ELSE(DEFINED TEST)
>    MESSAGE("TEST is not defined")
> ENDIF(DEFINED TEST)

I think this should work:
IF(COMMAND <command-name>)

Alex


More information about the CMake mailing list