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 | |
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')
-rw-r--r-- | toolchain/Android.cmake | 17 | ||||
-rw-r--r-- | toolchain/deployment-file-qt514.json.in | 2 |
2 files changed, 18 insertions, 1 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") diff --git a/toolchain/deployment-file-qt514.json.in b/toolchain/deployment-file-qt514.json.in index 65e2a0b8..5ef02040 100644 --- a/toolchain/deployment-file-qt514.json.in +++ b/toolchain/deployment-file-qt514.json.in @@ -11,7 +11,7 @@ ##EXTRALIBS## ##EXTRAPLUGINS## "android-package-source-directory": "$<TARGET_PROPERTY:create-apk-${QTANDROID_EXPORTED_TARGET},ANDROID_APK_DIR>", - "stdcpp-path": "@CMAKE_SYSROOT@/usr/lib", + "stdcpp-path": "@ANDROID_SYSROOT_PREFIX@/lib", "sdkBuildToolsRevision": "@ANDROID_SDK_BUILD_TOOLS_REVISION@", "android-min-sdk-version": "@ANDROID_API_LEVEL@", "android-target-sdk-version": "@ANDROID_SDK_COMPILE_API@", |