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>
This commit is contained in:
Alexey Edelev 2022-04-01 16:17:55 +02:00
parent 855ca9f48a
commit a42e7839b2

View File

@ -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