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 <cristian.adam@qt.io>
This commit is contained in:
Alexandru Croitor 2020-09-08 15:31:39 +02:00
parent a6a3b82ffb
commit 7b6d8261d8
2 changed files with 5 additions and 3 deletions

View File

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

View File

@ -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}")