moc_predefs.h do not contain __ANDROID__ with clang (NDK) anymore (missing target)
We use cmake to generate moc_predefs.h for Qt5 and his moc binary.
Since we switched to clang compiler with Android NDK we see that it does not provide __ANDROID__
anymore.
$ /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -dM -E -c /usr/share/cmake-3.12/Modules/CMakeCXXCompilerABI.cpp
[...]
$ /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++ -dM -E -c /usr/share/cmake-3.12/Modules/CMakeCXXCompilerABI.cpp
[...]
#define __ANDROID__ 1
Looks like cmake misses to pass the target to the clang.
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -dM -E -target aarch64-linux-android -c
Edited by André Klitzing