CMake: allow using ANDORID_NDK_ROOT for user projects
Allow CMake for Android to use ANDROID_NDK_ROOT to deduce the path for QT_CHAINLOAD_TOOLCHAIN_FILE instead of the user providing it manually. Change-Id: Ida728011d5ca8d5a723d341ea77b173e8f105f8c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
397b372517
commit
f8a83fc5c0
@ -134,6 +134,21 @@ function(qt_internal_create_toolchain_file)
|
|||||||
list(APPEND init_platform
|
list(APPEND init_platform
|
||||||
" set(ANDROID_SDK_ROOT \"${__qt_android_sdk_root}\" CACHE STRING \"\")")
|
" set(ANDROID_SDK_ROOT \"${__qt_android_sdk_root}\" CACHE STRING \"\")")
|
||||||
list(APPEND init_platform "endif()")
|
list(APPEND init_platform "endif()")
|
||||||
|
|
||||||
|
list(APPEND init_platform "if(NOT \"$\{ANDROID_NDK_ROOT\}\" STREQUAL \"\")")
|
||||||
|
list(APPEND init_platform
|
||||||
|
" set(__qt_toolchain_file_candidate \"$\{ANDROID_NDK_ROOT\}/build/cmake/android.toolchain.cmake\")")
|
||||||
|
list(APPEND init_platform " if(EXISTS \"$\{__qt_toolchain_file_candidate\}\")")
|
||||||
|
list(APPEND init_platform
|
||||||
|
" message(STATUS \"Android toolchain file within NDK detected: $\{__qt_toolchain_file_candidate\}\")")
|
||||||
|
list(APPEND init_platform " set(__qt_chainload_toolchain_file \"$\{__qt_toolchain_file_candidate\}\")")
|
||||||
|
list(APPEND init_platform " else()")
|
||||||
|
list(APPEND init_platform
|
||||||
|
" message(FATAL_ERROR \"Cannot find the toolchain file '$\{__qt_toolchain_file_candidate\}'. \"")
|
||||||
|
list(APPEND init_platform
|
||||||
|
" \"Please specify the toolchain file with -DQT_CHAINLOAD_TOOLCHAIN_FILE=<file>.\")")
|
||||||
|
list(APPEND init_platform " endif()")
|
||||||
|
list(APPEND init_platform "endif()")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string(REPLACE ";" "\n" init_vcpkg "${init_vcpkg}")
|
string(REPLACE ";" "\n" init_vcpkg "${init_vcpkg}")
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
@init_platform@
|
|
||||||
|
|
||||||
@init_qt_host_path@
|
@init_qt_host_path@
|
||||||
@init_qt_host_path_cmake_dir@
|
@init_qt_host_path_cmake_dir@
|
||||||
@init_original_toolchain_file@
|
@init_original_toolchain_file@
|
||||||
@init_vcpkg@
|
@init_vcpkg@
|
||||||
|
|
||||||
|
@init_platform@
|
||||||
|
|
||||||
if(NOT "${QT_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "")
|
if(NOT "${QT_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "")
|
||||||
set(__qt_chainload_toolchain_file "${QT_CHAINLOAD_TOOLCHAIN_FILE}")
|
set(__qt_chainload_toolchain_file "${QT_CHAINLOAD_TOOLCHAIN_FILE}")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user