When returning values from a function, you have to use the PARENT_SCOPE
argument of set():
function( test __ANDROID__ RETVAL )
if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
set( ${RETVAL} ${${RETVAL}} qwer2 PASRENT_SCOPE)
message( "Included. " )
endif(
Okay... but then with function I can't set external variables; but if(
__ANDROID__ ) works.
`result` never changes.
---
set( __ANDROID__ 1 )
function( test __ANDROID__ RETVAL )
if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
set( ${RETVAL}
Macros aren't functions, and macro parameters aren't CMake variables.
Expanding a macro parameter is effectively *textual* substitution, whereas
dereferencing a CMake variable is a semantic one.
In other words, inside your macro, the text __ANDROID__ (when not expanded)
never refers to the macro
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