summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2019-05-03 12:07:37 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2019-05-03 12:14:22 +0000
commit914b367c7f6a117130b8a56338c46a8102a1f77f (patch)
tree41e48599a25d481ab5362f599dbb8728abec7c13
parentc2379c469cb464df7c4ab78eb65e32f795ed050e (diff)
Fix finding host tools when cross-compiling
* When using a sysroot, just setting CMAKE_PREFIX_PATH to the QT_HOST_PATH is not sufficient in finding for example Qt5CoreTools because the QT_HOST_PATH would be prefixed by the sysroot. So this patch switches the mode to also enable looking outside of the sysroot. (done by Alexandru) * Once the Qt5CoreToolsConfigVersion.cmake was found, the built-in check for 32 vs. 64 bit compatibility by looking at the provided CMAKE_SIZEOF_VOID_P (4 when target is armv7 for example) and comparing it against the void* size used when building the tools would fail. Explicitly unsetting CMAKE_SIZEOF_VOID_P disables this check, and that's fine as we're not interested in any exported library targets -- where this could cause problems -- but merely programs to run. Change-Id: If2931dad023e39a3dbdaa17ac095131ad2c0ca60 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--cmake/QtBuild.cmake12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index f23c21901f..0ddc411025 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -1037,6 +1037,14 @@ function(add_qt_tool name)
# not get the proper prefix when using PATHS.
set(BACKUP_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH "${QT_HOST_PATH}")
+
+ # Search both with sysroots prepended as well as in the host system. When cross compiling
+ # the mode_package might be set to ONLY only, and the Qt5 tools packages are actually
+ # in the host system.
+ set(BACKUP_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE})
+ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE "BOTH")
+ set(BACKUP_CMAKE_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
+ set(CMAKE_SIZEOF_VOID_P "")
find_package(
${tools_package_name}
${PROJECT_VERSION}
@@ -1046,7 +1054,9 @@ function(add_qt_tool name)
NO_CMAKE_PACKAGE_REGISTRY
NO_CMAKE_SYSTEM_PATH
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY)
- set(CMAKE_PREFIX_PATH ${BACKUP_CMAKE_PREFIX_PATH})
+ set(CMAKE_SIZEOF_VOID_P "${BACKUP_CMAKE_SIZEOF_VOID_P}")
+ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE "${BACKUP_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}")
+ set(CMAKE_PREFIX_PATH "${BACKUP_CMAKE_PREFIX_PATH}")
if(${${tools_package_name}_FOUND} AND TARGET ${full_name})
get_property(path TARGET ${full_name} PROPERTY LOCATION)