diff options
author | Gabriel Souza Franco <gabrielfrancosouza@gmail.com> | 2020-09-12 17:37:26 -0300 |
---|---|---|
committer | Aleix Pol Gonzalez <aleixpol@kde.org> | 2020-09-16 14:56:34 +0000 |
commit | 0577d42ac40cac24a07d4555d1253996f1baed5a (patch) | |
tree | 0c3575404c7e9d640920638d21ff515482740ce5 /toolchain/Android.cmake | |
parent | 7b05256f9e8a5d87a4aa2a3a9b84ec9ce8a65fe5 (diff) | |
download | extra-cmake-modules-0577d42ac40cac24a07d4555d1253996f1baed5a.tar.gz extra-cmake-modules-0577d42ac40cac24a07d4555d1253996f1baed5a.tar.bz2 |
Fix find_library on Android with NDK < 22
Diffstat (limited to 'toolchain/Android.cmake')
-rw-r--r-- | toolchain/Android.cmake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake index de40c986..39e15495 100644 --- a/toolchain/Android.cmake +++ b/toolchain/Android.cmake @@ -165,6 +165,23 @@ set(ANDROID_PLATFORM "android-${CMAKE_ANDROID_API}") set(ANDROID_STL ${CMAKE_ANDROID_STL_TYPE}) include(${CMAKE_ANDROID_NDK}/build/cmake/android.toolchain.cmake REQUIRED) +## HACK: Remove when we can depend on NDK r22 +# Workaround issue https://github.com/android/ndk/issues/929 +if(ANDROID_NDK_MAJOR VERSION_LESS 22) + unset(CMAKE_SYSROOT) + set(ANDROID_SYSROOT_PREFIX "${ANDROID_TOOLCHAIN_ROOT}/sysroot/usr") + + list(APPEND CMAKE_SYSTEM_INCLUDE_PATH + "${ANDROID_SYSROOT_PREFIX}/include/${CMAKE_LIBRARY_ARCHITECTURE}") + list(APPEND CMAKE_SYSTEM_INCLUDE_PATH "${ANDROID_SYSROOT_PREFIX}/include") + + # Prepend in reverse order + list(PREPEND CMAKE_SYSTEM_LIBRARY_PATH + "${ANDROID_SYSROOT_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}") + list(PREPEND CMAKE_SYSTEM_LIBRARY_PATH + "${ANDROID_SYSROOT_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${ANDROID_PLATFORM_LEVEL}") +endif() + # these aren't set yet at this point by the Android toolchain, but without # those the find_package() call in ECMAndroidDeployQt will fail set(CMAKE_FIND_LIBRARY_PREFIXES "lib") |