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>
This commit is contained in:
parent
c2379c469c
commit
914b367c7f
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user