How to add a custom MACRO when using NDK?

android-ndk

Solution

If you would like to add a special definition when compiling your NDK code (jni) add the following into your Android.mk:

LOCAL_CFLAGS    := -DMYDEFINE

This will define the Macro MYDEFINE in your c/c++ code. Here an example

#ifdef MYDEFINE
// We build the project with this special macro
#else
// We build without setting the macro in the LOCAL_CFLAGS
#endif

Problem

I need some custom MACROs in my NDK projects however I have no ideal how to add and I found no answers Could anyone please help? Many thanks!

Original source