Fixed android toolchain with newest NDK (#21465)

* Fixed android toolchain with newest NDK
ANDROID_NATIVE_API_LEVEL has been removed from NDK cmake toolchain so we now have to use ANDROID_PLATFORM

* Fix android toolchain: Maintain backward compatibility for older NDK
This commit is contained in:
Christophe Calmejane 2021-12-07 05:15:20 +01:00 committed by GitHub
parent 46ad6d4a07
commit be65fbbf75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,11 @@ set(ANDROID_CPP_FEATURES "rtti exceptions" CACHE STRING "")
set(CMAKE_SYSTEM_NAME Android CACHE STRING "")
set(ANDROID_TOOLCHAIN clang CACHE STRING "")
set(ANDROID_NATIVE_API_LEVEL ${CMAKE_SYSTEM_VERSION} CACHE STRING "")
if(CMAKE_SYSTEM_VERSION MATCHES "^[0-9]+$")
set(ANDROID_PLATFORM android-${CMAKE_SYSTEM_VERSION} CACHE STRING "")
else()
set(ANDROID_PLATFORM ${CMAKE_SYSTEM_VERSION} CACHE STRING "")
endif()
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang CACHE STRING "")
if (VCPKG_TARGET_TRIPLET MATCHES "^arm64-android")