summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2022-04-01 16:17:55 +0200
committerAlexey Edelev <alexey.edelev@qt.io>2022-04-04 15:41:19 +0200
commita42e7839b27c9fc29fc0b37c342c8c489d445219 (patch)
tree6075340afc7c83a6972c1f3d0ee987c79eccaa97 /cmake
parent855ca9f48a40040e1ca7b1270ee8c85f81c8bd98 (diff)
Make possible to set android SDK/NDK roots from environment
Read the ANDROID_<SDK|NDK>_ROOT environment variables in qt toolchain file and use them to chainload the android toolchain file. Pick-to: 6.2 6.3 Change-Id: I1940ffbaa557974fc26005f4d051030f2cc5c7e0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtToolchainHelpers.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmake/QtToolchainHelpers.cmake b/cmake/QtToolchainHelpers.cmake
index f7ea59d1b5..a674973f4d 100644
--- a/cmake/QtToolchainHelpers.cmake
+++ b/cmake/QtToolchainHelpers.cmake
@@ -184,6 +184,20 @@ set(__qt_chainload_toolchain_file \"\${__qt_initially_configured_toolchain_file}
list(APPEND init_platform "endif()")
endif()
elseif(ANDROID)
+ list(APPEND init_platform
+"# Detect Android SDK/NDK from environment before loading the Android platform toolchain file."
+"if(NOT DEFINED ANDROID_SDK_ROOT)"
+" if(NOT \"\$ENV{ANDROID_SDK_ROOT}\" STREQUAL \"\")"
+" set(ANDROID_SDK_ROOT \"\$ENV{ANDROID_SDK_ROOT}\" CACHE STRING \"Path to the Android SDK\")"
+" endif()"
+"endif()"
+"if(NOT DEFINED ANDROID_NDK_ROOT)"
+" if(NOT \"\$ENV{ANDROID_NDK_ROOT}\" STREQUAL \"\")"
+" set(ANDROID_NDK_ROOT \"\$ENV{ANDROID_NDK_ROOT}\" CACHE STRING \"Path to the Android NDK\")"
+" endif()"
+"endif()"
+ )
+
foreach(var ANDROID_PLATFORM ANDROID_NATIVE_API_LEVEL ANDROID_STL
ANDROID_ABI ANDROID_SDK_ROOT ANDROID_NDK_ROOT)
list(APPEND init_additional_used_variables