diff options
-rw-r--r-- | cmake/QtToolchainHelpers.cmake | 15 | ||||
-rw-r--r-- | cmake/qt.toolchain.cmake.in | 5 |
2 files changed, 18 insertions, 2 deletions
diff --git a/cmake/QtToolchainHelpers.cmake b/cmake/QtToolchainHelpers.cmake index a067ef7c0c..2593aa7429 100644 --- a/cmake/QtToolchainHelpers.cmake +++ b/cmake/QtToolchainHelpers.cmake @@ -134,6 +134,21 @@ function(qt_internal_create_toolchain_file) list(APPEND init_platform " set(ANDROID_SDK_ROOT \"${__qt_android_sdk_root}\" CACHE STRING \"\")") 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() string(REPLACE ";" "\n" init_vcpkg "${init_vcpkg}") diff --git a/cmake/qt.toolchain.cmake.in b/cmake/qt.toolchain.cmake.in index f1a7a5abaa..e97e46879d 100644 --- a/cmake/qt.toolchain.cmake.in +++ b/cmake/qt.toolchain.cmake.in @@ -1,9 +1,10 @@ -@init_platform@ - @init_qt_host_path@ @init_qt_host_path_cmake_dir@ @init_original_toolchain_file@ @init_vcpkg@ + +@init_platform@ + if(NOT "${QT_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "") set(__qt_chainload_toolchain_file "${QT_CHAINLOAD_TOOLCHAIN_FILE}") endif() |