Re: [CMake] Hard to do if in Macro

2018-01-31 Thread Petr Kmoch
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(

Re: [CMake] Hard to do if in Macro

2018-01-30 Thread J Decker
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}

Re: [CMake] Hard to do if in Macro

2018-01-30 Thread Petr Kmoch
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

[CMake] Hard to do if in Macro

2018-01-30 Thread J Decker
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