[CMake] Hard to do if in Macro

J Decker d3ck0r at gmail.com
Tue Jan 30 03:11:08 EST 2018


Why do I have to do

if( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")
endif( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")

in a macro like...
----------------------

set( __ANDROID__ 1 )

macro( test __ANDROID__ )

  if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
    message( "Included..... " )
  endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")

  if( __ANDROID__ )
    message( "ALWAYS Included ${__ANDROID__}" )
  endif( __ANDROID__ )

endmacro( test )

test( __ANDROID__ )
test( ${__ANDROID__} )
test( OFF )

----------
Output

Included.....
ALWAYS Included __ANDROID__
Included.....
ALWAYS Included 1
ALWAYS Included OFF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180130/946bae81/attachment.html>


More information about the CMake mailing list