summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-06-03 17:50:16 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-06-07 16:48:57 +0000
commit5ddb13d0d4fc6d4f45dc1f0fb49ed65a299d88dd (patch)
tree540dbbe46d8b8b04d3fb299a5a1c3cbc5f6d8ed9
parent4dfc58264449932648f3e7a31b3ef4494e20d54a (diff)
CMake: Fix Android multi-abi builds in Qt Creator
Qt Creator passes -DANDROID_NDK to the main project configuration whereas the Qt toolchain file expects -DANDROID_NDK_ROOT. This causes the configuration of the sub-builds to fail not finding the android toolchain, and trying to use the CI ndk toolchain path. Make sure to consider both variables. Also change the conditions to evaluate the variable as a variable explicitly, to avoid passing an empty option if the variable is unset. If the variable is unset, CMake would treat the variable as an actual string which would always not equal the empty string. Amends d6919b073aaae617f1ff37d18da14e315f202005 Pick-to: 6.3 6.4 Task-number: QTBUG-104013 Task-number: QTBUG-102041 Change-Id: Ifee48953ce50bc616c49c59d72e845c6d9418187 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
-rw-r--r--src/corelib/Qt6AndroidMacros.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake
index 91daa7b4c9..139b764ad2 100644
--- a/src/corelib/Qt6AndroidMacros.cmake
+++ b/src/corelib/Qt6AndroidMacros.cmake
@@ -947,12 +947,17 @@ function(_qt_internal_configure_android_multiabi_target target)
"-DQT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH=${escaped_host_packages_prefix_path}")
endif()
- if(NOT ANDROID_SDK_ROOT STREQUAL "")
+ if(ANDROID_SDK_ROOT)
list(APPEND extra_cmake_args "-DANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}")
endif()
- if(NOT ANDROID_NDK_ROOT STREQUAL "")
+ # ANDROID_NDK_ROOT is invented by Qt and is what the qt toolchain file expects
+ if(ANDROID_NDK_ROOT)
list(APPEND extra_cmake_args "-DANDROID_NDK_ROOT=${ANDROID_NDK_ROOT}")
+
+ # ANDROID_NDK is passed by Qt Creator and is also present in the android toolchain file.
+ elseif(ANDROID_NDK)
+ list(APPEND extra_cmake_args "-DANDROID_NDK_ROOT=${ANDROID_NDK}")
endif()
set(missing_qt_abi_toolchains "")