From 7b6d8261d87daeecf0f541496b7a35911ae7e86b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 8 Sep 2020 15:31:39 +0200 Subject: [PATCH] CMake: Fix building of non-qtbase repos on Android with Windows host The generated toolchain file embedded windows style paths for the android sdk and chainloaded toolchain. This caused CMake does fail at configure time while trying to evaluate backslashes as escape chars. Also syncqt was searched for in libexec, which is not the right directory on Windows. Use the host info package to get the location of the 'libexec'. Task-number: QTBUG-85399 Task-number: QTBUG-85911 Task-number: QTBUG-86053 Change-Id: I1b15ce84496d52c3fda2f65138e1eac43bc95c9e Reviewed-by: Cristian Adam --- cmake/QtBaseGlobalTargets.cmake | 6 ++++-- cmake/QtSyncQtHelpers.cmake | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index 975defcb83..4e4f7a442a 100644 --- a/cmake/QtBaseGlobalTargets.cmake +++ b/cmake/QtBaseGlobalTargets.cmake @@ -110,7 +110,8 @@ endif()") endif() if(CMAKE_TOOLCHAIN_FILE) - set(init_original_toolchain_file "set(__qt_chainload_toolchain_file \"${CMAKE_TOOLCHAIN_FILE}\")") + file(TO_CMAKE_PATH "${CMAKE_TOOLCHAIN_FILE}" __qt_chainload_toolchain_file) + set(init_original_toolchain_file "set(__qt_chainload_toolchain_file \"${__qt_chainload_toolchain_file}\")") endif() if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE) @@ -196,7 +197,8 @@ elseif(ANDROID) list(APPEND init_platform "set(ANDROID_STL \"${ANDROID_STL}\" CACHE STRING \"\")") list(APPEND init_platform "set(ANDROID_ABI \"${ANDROID_ABI}\" CACHE STRING \"\")") list(APPEND init_platform "if (NOT DEFINED ANDROID_SDK_ROOT)") - list(APPEND init_platform " set(ANDROID_SDK_ROOT \"${ANDROID_SDK_ROOT}\" CACHE STRING \"\")") + file(TO_CMAKE_PATH "${ANDROID_SDK_ROOT}" __qt_android_sdk_root) + list(APPEND init_platform " set(ANDROID_SDK_ROOT \"${__qt_android_sdk_root}\" CACHE STRING \"\")") list(APPEND init_platform "endif()") endif() diff --git a/cmake/QtSyncQtHelpers.cmake b/cmake/QtSyncQtHelpers.cmake index a161c8ecbe..c8d89d64ee 100644 --- a/cmake/QtSyncQtHelpers.cmake +++ b/cmake/QtSyncQtHelpers.cmake @@ -29,7 +29,7 @@ function(qt_ensure_sync_qt) DESTINATION "${syncqt_install_dir}") elseif(QT_HOST_PATH) get_filename_component(syncqt_absolute_path - "${QT_HOST_PATH}/${INSTALL_LIBEXECDIR}/syncqt.pl" + "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}/syncqt.pl" ABSOLUTE) set(QT_SYNCQT "${syncqt_absolute_path}" CACHE FILEPATH "syncqt script") message(STATUS "Using host syncqt found at: ${QT_SYNCQT}")