aboutsummaryrefslogtreecommitdiff
path: root/toolchain/Android.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'toolchain/Android.cmake')
-rw-r--r--toolchain/Android.cmake17
1 files changed, 14 insertions, 3 deletions
diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake
index 3e6a877c..e3ace15a 100644
--- a/toolchain/Android.cmake
+++ b/toolchain/Android.cmake
@@ -45,8 +45,12 @@
# ``ANDROID_ABI``
# The ABI to use. See the ``sources/cxx-stl/gnu-libstdc++/*/libs``
# directories in the NDK. Default: ``armeabi-v7a``.
+# ``ANDROID_SDK_COMPILE_API``
+# The platform API level to compile against. May be different from the NDK
+# target. Default: newest installed version (e.g. android-30).
# ``ANDROID_SDK_BUILD_TOOLS_REVISION``
-# The build tools version to use. Default: ``21.1.1``.
+# The build tools version to use.
+# Default: newest installed version (e.g. ``30.0.2``).
# ``ANDROID_EXTRA_LIBS``
# The ";"-separated list of full paths to libs to include in resulting APK.
#
@@ -137,9 +141,16 @@ set_deprecated_variable(CMAKE_ANDROID_ARCH_ABI ANDROID_ABI "$ENV{ANDROID_ARCH_AB
set(ANDROID_SDK_ROOT "$ENV{ANDROID_SDK_ROOT}" CACHE PATH "Android SDK path")
+file(GLOB platforms LIST_DIRECTORIES TRUE RELATIVE ${ANDROID_SDK_ROOT}/platforms ${ANDROID_SDK_ROOT}/platforms/*)
+list(GET platforms -1 _default_platform)
+set(ANDROID_SDK_COMPILE_API "${_default_platform}" CACHE STRING "Android API Level")
+if(ANDROID_SDK_COMPILE_API MATCHES "^android-([0-9]+)$")
+ set(ANDROID_SDK_COMPILE_API ${CMAKE_MATCH_1})
+endif()
+
file(GLOB build-tools LIST_DIRECTORIES TRUE RELATIVE ${ANDROID_SDK_ROOT}/build-tools ${ANDROID_SDK_ROOT}/build-tools/*)
-list(GET build-tools 0 _default_sdk)
-set(ANDROID_SDK_BUILD_TOOLS_REVISION "${_default_sdk}" CACHE STRING "Android API Level")
+list(GET build-tools -1 _default_sdk)
+set(ANDROID_SDK_BUILD_TOOLS_REVISION "${_default_sdk}" CACHE STRING "Android Build Tools version")
set(CMAKE_SYSTEM_VERSION ${CMAKE_ANDROID_API})
set(CMAKE_SYSTEM_NAME Android)