2022-07-05 11:26:52 +00:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2022-08-19 13:21:34 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2022-07-05 11:26:52 +00:00
|
|
|
|
2022-07-13 13:11:40 +00:00
|
|
|
# Note that target_dep_list does not accept a list of values, but a var name that contains the
|
|
|
|
# list of dependencies. See foreach block for reference.
|
|
|
|
macro(_qt_internal_find_third_party_dependencies target target_dep_list)
|
|
|
|
foreach(__qt_${target}_target_dep IN LISTS ${target_dep_list})
|
|
|
|
list(GET __qt_${target}_target_dep 0 __qt_${target}_pkg)
|
|
|
|
list(GET __qt_${target}_target_dep 1 __qt_${target}_is_optional)
|
|
|
|
list(GET __qt_${target}_target_dep 2 __qt_${target}_version)
|
|
|
|
list(GET __qt_${target}_target_dep 3 __qt_${target}_components)
|
|
|
|
list(GET __qt_${target}_target_dep 4 __qt_${target}_optional_components)
|
|
|
|
set(__qt_${target}_find_package_args "${__qt_${target}_pkg}")
|
|
|
|
if(__qt_${target}_version)
|
|
|
|
list(APPEND __qt_${target}_find_package_args "${__qt_${target}_version}")
|
|
|
|
endif()
|
|
|
|
if(__qt_${target}_components)
|
|
|
|
string(REPLACE " " ";" __qt_${target}_components "${__qt_${target}_components}")
|
|
|
|
list(APPEND __qt_${target}_find_package_args COMPONENTS ${__qt_${target}_components})
|
|
|
|
endif()
|
|
|
|
if(__qt_${target}_optional_components)
|
|
|
|
string(REPLACE " " ";"
|
|
|
|
__qt_${target}_optional_components "${__qt_${target}_optional_components}")
|
|
|
|
list(APPEND __qt_${target}_find_package_args
|
|
|
|
OPTIONAL_COMPONENTS ${__qt_${target}_optional_components})
|
|
|
|
endif()
|
|
|
|
|
2022-07-14 15:00:56 +00:00
|
|
|
_qt_internal_save_find_package_context_for_debugging(${target})
|
|
|
|
|
2022-07-13 13:11:40 +00:00
|
|
|
if(__qt_${target}_is_optional)
|
|
|
|
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
|
|
|
list(APPEND __qt_${target}_find_package_args QUIET)
|
|
|
|
endif()
|
|
|
|
find_package(${__qt_${target}_find_package_args})
|
|
|
|
else()
|
|
|
|
find_dependency(${__qt_${target}_find_package_args})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
# Note that target_dep_list does not accept a list of values, but a var name that contains the
|
|
|
|
# list of dependencies. See foreach block for reference.
|
|
|
|
macro(_qt_internal_find_tool_dependencies target target_dep_list)
|
|
|
|
if(NOT "${${target_dep_list}}" STREQUAL "" AND NOT "${QT_HOST_PATH}" STREQUAL "")
|
|
|
|
# Make sure that the tools find the host tools first
|
|
|
|
set(BACKUP_${target}_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
|
|
|
|
set(BACKUP_${target}_CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
|
|
|
|
list(PREPEND CMAKE_PREFIX_PATH "${QT_HOST_PATH_CMAKE_DIR}"
|
|
|
|
"${_qt_additional_host_packages_prefix_paths}")
|
|
|
|
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}"
|
|
|
|
"${_qt_additional_host_packages_root_paths}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
foreach(__qt_${target}_target_dep IN LISTS ${target_dep_list})
|
|
|
|
list(GET __qt_${target}_target_dep 0 __qt_${target}_pkg)
|
|
|
|
list(GET __qt_${target}_target_dep 1 __qt_${target}_version)
|
|
|
|
|
|
|
|
unset(__qt_${target}_find_package_args)
|
|
|
|
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
|
|
|
list(APPEND __qt_${target}_find_package_args QUIET)
|
|
|
|
endif()
|
2022-07-14 15:00:56 +00:00
|
|
|
|
|
|
|
_qt_internal_save_find_package_context_for_debugging(${target})
|
|
|
|
|
2022-07-13 13:11:40 +00:00
|
|
|
find_package(${__qt_${target}_pkg}
|
|
|
|
${__qt_${target}_version}
|
|
|
|
${__qt_${target}_find_package_args}
|
|
|
|
PATHS
|
2022-07-13 17:09:32 +00:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/.."
|
|
|
|
"${_qt_cmake_dir}"
|
2022-07-13 13:11:40 +00:00
|
|
|
${_qt_additional_packages_prefix_paths}
|
|
|
|
)
|
2023-01-06 15:12:34 +00:00
|
|
|
if (NOT ${__qt_${target}_pkg}_FOUND AND NOT QT_ALLOW_MISSING_TOOLS_PACKAGES)
|
2022-07-13 17:05:34 +00:00
|
|
|
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
|
|
|
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
|
|
|
"${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \
|
|
|
|
${__qt_${target}_pkg} could not be found.")
|
2022-07-13 13:11:40 +00:00
|
|
|
if(NOT "${QT_HOST_PATH}" STREQUAL "")
|
|
|
|
set(CMAKE_PREFIX_PATH ${BACKUP_${target}_CMAKE_PREFIX_PATH})
|
|
|
|
set(CMAKE_FIND_ROOT_PATH ${BACKUP_${target}_CMAKE_FIND_ROOT_PATH})
|
|
|
|
endif()
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if(NOT "${${target_dep_list}}" STREQUAL "" AND NOT "${QT_HOST_PATH}" STREQUAL "")
|
|
|
|
set(CMAKE_PREFIX_PATH ${BACKUP_${target}_CMAKE_PREFIX_PATH})
|
|
|
|
set(CMAKE_FIND_ROOT_PATH ${BACKUP_${target}_CMAKE_FIND_ROOT_PATH})
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2021-06-17 14:18:59 +00:00
|
|
|
# Please note the target_dep_list accepts not the actual list values but the list names that
|
|
|
|
# contain preformed dependencies. See foreach block for reference.
|
|
|
|
# The same applies for find_dependency_path_list.
|
2022-07-14 13:28:12 +00:00
|
|
|
macro(_qt_internal_find_qt_dependencies target target_dep_list find_dependency_path_list)
|
|
|
|
foreach(__qt_${target}_target_dep IN LISTS ${target_dep_list})
|
|
|
|
list(GET __qt_${target}_target_dep 0 __qt_${target}_pkg)
|
|
|
|
list(GET __qt_${target}_target_dep 1 __qt_${target}_version)
|
2021-06-17 14:18:59 +00:00
|
|
|
|
2022-07-14 13:28:12 +00:00
|
|
|
if (NOT ${__qt_${target}_pkg}_FOUND)
|
2022-07-19 16:12:18 +00:00
|
|
|
|
|
|
|
# TODO: Remove Private handling once sufficient time has passed, aka all developers
|
|
|
|
# updated their builds not to contain stale FooDependencies.cmake files without the
|
|
|
|
# _qt_package_name property.
|
2022-07-14 13:28:12 +00:00
|
|
|
set(__qt_${target}_pkg_names ${__qt_${target}_pkg})
|
|
|
|
if(__qt_${target}_pkg MATCHES "(.*)Private$")
|
|
|
|
set(__qt_${target}_pkg_names "${CMAKE_MATCH_1};${__qt_${target}_pkg}")
|
2021-06-17 14:18:59 +00:00
|
|
|
endif()
|
2022-07-14 15:00:56 +00:00
|
|
|
|
|
|
|
_qt_internal_save_find_package_context_for_debugging(${target})
|
|
|
|
|
2022-07-14 13:28:12 +00:00
|
|
|
find_dependency(${__qt_${target}_pkg} ${__qt_${target}_version}
|
2021-06-17 14:18:59 +00:00
|
|
|
NAMES
|
2022-07-14 13:28:12 +00:00
|
|
|
${__qt_${target}_pkg_names}
|
2021-06-17 14:18:59 +00:00
|
|
|
PATHS
|
|
|
|
${${find_dependency_path_list}}
|
CMake: Fix QT_ADDITIONAL_PACKAGES_PREFIX_PATH for cross-builds
The QT_ADDITIONAL_PACKAGES_PREFIX_PATH variable was introduced to
allow specifying extra locations to find Qt packages.
The reason it was introduced instead of just using CMAKE_PREFIX_PATH
is because the Qt6 component find_package call uses NO_DEFAULT_PATH
which means CMAKE_PREFIX_PATH is ignored.
We use NO_DEFAULT_PATH to ensure we don't accidentally pick up
system / distro Qt packages.
The paths from QT_ADDITIONAL_PACKAGES_PREFIX_PATH are added to the
find_package PATHS option in the Qt6 package, each
ModuleDependencies.cmake file and some other places.
Unfortunately that's not enough to make it work for cross-builds.
Imagine the following scenario.
host qtbase, qtdeclarative installed in /host_qt
target qtbase installed in /target_qtbase
target qtdeclarative installed in /target_qtdeclarative
We want to cross-build qtlottie.
We configure qtlottie as follows
/target_qtbase/bin/qt-configure-module /qtlottie_src -- -DQT_ADDITIONAL_PACKAGES_PREFIX_PATH=/target_qtdeclarative
We expect the target QtQuick package to be found, but it won't be.
The reason is that QT_ADDITIONAL_PACKAGES_PREFIX_PATH is added to the
PATHs option, but we don't adjust CMAKE_FIND_ROOT_PATH.
Without adding the new paths in CMAKE_FIND_ROOT_PATH, CMake will
re-root the passed PATHs under the existing CMAKE_FIND_ROOT_PATH,
which is QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX, which evaluates to
/target_qtbase. There is no QtQuick package there.
To fix this, prepend the values of QT_ADDITIONAL_PACKAGES_PREFIX_PATH
to CMAKE_FIND_ROOT_PATH.
The location where we currently do CMAKE_FIND_ROOT_PATH manipulations
is in the qt.toolchain.cmake file, so to be consistent, we prepend the
new prefixes there as well.
We need to adjust both CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH,
due the path re-rooting bug in CMake.
See https://gitlab.kitware.com/cmake/cmake/-/issues/21937 as well as
the existing comment in qt.toolchain.cmake marked with
REROOT_PATH_ISSUE_MARKER.
We also need to do a few more things to make the setup work
Because Qt6Config uses NO_DEFAULT_PATH, the CMAKE_PREFIX_PATH
adjustments we do in the toolchain file are not enough, so we still need
to add the same prefixes to the Qt6Config find_package PATHS option.
One would ask why do we need to adjust CMAKE_PREFIX_PATH at all then.
It's for find_package(Qt6Foo) calls to work which don't go through
the Qt6Config umbrella package.
To make the CMake re-rooting behavior happy, we need to ensure the
provided paths are absolute.
So we iterate over the values of QT_ADDITIONAL_PACKAGES_PREFIX_PATH,
to make them absolute. We do the same for the environment variable.
We need to append lib/cmake to the prefixes which are added to
CMAKE_PREFIX_PATH, otherwise the CMake re-rooting bug is hit.
We need to specify the Qt6 package location (${_qt_cmake_dir}) to the
PATHS option in the various Dependencies.cmake.in files, to ensure
that dependency resolution can jump around between the Qt6 dir and
the additional prefixes. Previously the dependency lookup code assumed
that all dependencies would be within the same prefix.
The same is needed for qt and qml plugin dependency lookup.
Amends 7bb91398f25cb2016c0558fd397b376f413e3e96
Amends 60c87c68016c6f02b0eddd4002f75a49ab51d4a8
Amends 5bbd700124d13a292ff8bae6045316112500e230
Pick-to: 6.2
Fixes: QTBUG-95854
Change-Id: I35ae82330fec427d0d38fc9a0542ffafff52556a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-17 15:03:02 +00:00
|
|
|
${_qt_additional_packages_prefix_paths}
|
2021-06-17 14:18:59 +00:00
|
|
|
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
|
|
|
|
${__qt_use_no_default_path_for_qt_packages}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endmacro()
|
2022-07-13 17:22:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
# TODO: Remove once a dependency update completes and most developers have the Dependencies.cmake
|
|
|
|
# files updated in their builds.
|
|
|
|
# The name is too generic, it doesn't look for any kind of dependencies but only Qt package
|
|
|
|
# dependencies.
|
|
|
|
macro(_qt_internal_find_dependencies target_dep_list find_dependency_path_list)
|
2022-07-14 13:28:12 +00:00
|
|
|
_qt_internal_find_qt_dependencies("none" "${target_dep_list}" "${find_dependency_path_list}")
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
# If a dependency package was not found, provide some hints in the error message on how to debug
|
|
|
|
# the issue.
|
2022-07-14 15:00:56 +00:00
|
|
|
#
|
2022-07-14 13:28:12 +00:00
|
|
|
# pkg_name_var should be the variable name that contains the package that was not found.
|
|
|
|
# e.g. __qt_Core_pkg
|
2022-07-14 15:00:56 +00:00
|
|
|
#
|
2022-07-14 13:28:12 +00:00
|
|
|
# message_out_var should contain the variable name of the original "not found" message, and it
|
|
|
|
# will have the hints appended to it as a string. e.g. ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
|
|
|
#
|
2022-07-14 15:00:56 +00:00
|
|
|
# infix is used as a unique prefix to retrieve the find_package paths context for the last package
|
|
|
|
# that was not found, for debugging purposes.
|
|
|
|
#
|
2022-07-14 13:28:12 +00:00
|
|
|
# The function should not be called in Dependencies.cmake files directly, because find_dependency
|
|
|
|
# returns out of the included file.
|
2022-07-14 15:00:56 +00:00
|
|
|
macro(_qt_internal_suggest_dependency_debugging infix pkg_name_var message_out_var)
|
2022-07-14 13:28:12 +00:00
|
|
|
if(${pkg_name_var}
|
|
|
|
AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND
|
|
|
|
AND ${message_out_var})
|
|
|
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.23")
|
|
|
|
string(APPEND ${message_out_var}
|
|
|
|
"\nConfiguring with --debug-find-pkg=${${pkg_name_var}} might reveal \
|
|
|
|
details why the package was not found.")
|
|
|
|
elseif(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17")
|
|
|
|
string(APPEND ${message_out_var}
|
|
|
|
"\nConfiguring with -DCMAKE_FIND_DEBUG_MODE=TRUE might reveal \
|
|
|
|
details why the package was not found.")
|
|
|
|
endif()
|
2022-07-14 15:00:56 +00:00
|
|
|
|
|
|
|
if(NOT QT_DEBUG_FIND_PACKAGE)
|
|
|
|
string(APPEND ${message_out_var}
|
|
|
|
"\nConfiguring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some of \
|
|
|
|
the path variables that find_package uses to try and find the package.")
|
|
|
|
else()
|
|
|
|
string(APPEND ${message_out_var}
|
|
|
|
"\n find_package search path values and other context for the last package that was not found:"
|
|
|
|
"\n CMAKE_MODULE_PATH: ${_qt_${infix}_CMAKE_MODULE_PATH}"
|
|
|
|
"\n CMAKE_PREFIX_PATH: ${_qt_${infix}_CMAKE_PREFIX_PATH}"
|
|
|
|
"\n \$ENV{CMAKE_PREFIX_PATH}: $ENV{CMAKE_PREFIX_PATH}"
|
|
|
|
"\n CMAKE_FIND_ROOT_PATH: ${_qt_${infix}_CMAKE_FIND_ROOT_PATH}"
|
|
|
|
"\n _qt_additional_packages_prefix_paths: ${_qt_${infix}_qt_additional_packages_prefix_paths}"
|
|
|
|
"\n _qt_additional_host_packages_prefix_paths: ${_qt_${infix}_qt_additional_host_packages_prefix_paths}"
|
|
|
|
"\n _qt_cmake_dir: ${_qt_${infix}_qt_cmake_dir}"
|
|
|
|
"\n QT_HOST_PATH: ${QT_HOST_PATH}"
|
|
|
|
"\n Qt6HostInfo_DIR: ${Qt6HostInfo_DIR}"
|
|
|
|
"\n Qt6_DIR: ${Qt6_DIR}"
|
|
|
|
"\n CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}"
|
|
|
|
"\n CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}"
|
|
|
|
"\n CMAKE_SYSROOT: ${CMAKE_SYSROOT}"
|
|
|
|
"\n \$ENV{PATH}: $ENV{PATH}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
# Save find_package search paths context just before a find_package call, to be shown with a
|
|
|
|
# package not found message.
|
|
|
|
macro(_qt_internal_save_find_package_context_for_debugging infix)
|
|
|
|
if(QT_DEBUG_FIND_PACKAGE)
|
|
|
|
set(_qt_${infix}_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}")
|
|
|
|
set(_qt_${infix}_CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}")
|
|
|
|
set(_qt_${infix}_CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}")
|
|
|
|
set(_qt_${infix}_qt_additional_packages_prefix_paths
|
|
|
|
"${_qt_additional_packages_prefix_paths}")
|
|
|
|
set(_qt_${infix}_qt_additional_host_packages_prefix_paths
|
|
|
|
"${_qt_additional_host_packages_prefix_paths}")
|
|
|
|
set(_qt_${infix}_qt_cmake_dir "${_qt_cmake_dir}")
|
2022-07-14 13:28:12 +00:00
|
|
|
endif()
|
2022-07-13 17:22:37 +00:00
|
|
|
endmacro()
|
2022-07-15 16:14:20 +00:00
|
|
|
|
2022-07-18 12:14:41 +00:00
|
|
|
function(_qt_internal_determine_if_host_info_package_needed out_var)
|
|
|
|
set(needed FALSE)
|
2022-07-18 14:09:30 +00:00
|
|
|
|
|
|
|
# If a QT_HOST_PATH is provided when configuring qtbase, we assume it's a cross build
|
|
|
|
# and thus we require the QT_HOST_PATH to be provided also when using the cross-built Qt.
|
|
|
|
# This tells the QtConfigDependencies file to do appropriate requirement checks.
|
|
|
|
if(NOT "${QT_HOST_PATH}" STREQUAL "" AND NOT QT_NO_REQUIRE_HOST_PATH_CHECK)
|
2022-07-18 12:14:41 +00:00
|
|
|
set(needed TRUE)
|
|
|
|
endif()
|
|
|
|
set(${out_var} "${needed}" PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
macro(_qt_internal_find_host_info_package platform_requires_host_info)
|
|
|
|
if(${platform_requires_host_info})
|
2022-07-15 16:14:20 +00:00
|
|
|
find_package(Qt6HostInfo
|
|
|
|
CONFIG
|
|
|
|
REQUIRED
|
|
|
|
PATHS "${QT_HOST_PATH}"
|
|
|
|
"${QT_HOST_PATH_CMAKE_DIR}"
|
|
|
|
NO_CMAKE_FIND_ROOT_PATH
|
|
|
|
NO_DEFAULT_PATH)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
2022-07-18 14:09:30 +00:00
|
|
|
|
|
|
|
macro(_qt_internal_setup_qt_host_path
|
|
|
|
host_path_required
|
|
|
|
initial_qt_host_path
|
|
|
|
initial_qt_host_path_cmake_dir
|
|
|
|
)
|
|
|
|
# Set up QT_HOST_PATH and do sanity checks.
|
|
|
|
# A host path is required when cross-compiling but optional when doing a native build.
|
|
|
|
# Requiredness can be overridden via variable.
|
|
|
|
if(DEFINED QT_REQUIRE_HOST_PATH_CHECK)
|
|
|
|
set(_qt_platform_host_path_required "${QT_REQUIRE_HOST_PATH_CHECK}")
|
|
|
|
else()
|
|
|
|
set(_qt_platform_host_path_required "${host_path_required}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(_qt_platform_host_path_required)
|
|
|
|
# QT_HOST_PATH precedence:
|
|
|
|
# - cache variable / command line option
|
|
|
|
# - environment variable
|
|
|
|
# - initial QT_HOST_PATH when qtbase was configured (and the directory exists)
|
|
|
|
if(NOT DEFINED QT_HOST_PATH)
|
|
|
|
if(DEFINED ENV{QT_HOST_PATH})
|
|
|
|
set(QT_HOST_PATH "$ENV{QT_HOST_PATH}" CACHE PATH "")
|
|
|
|
elseif(NOT "${initial_qt_host_path}" STREQUAL "" AND EXISTS "${initial_qt_host_path}")
|
|
|
|
set(QT_HOST_PATH "${initial_qt_host_path}" CACHE PATH "")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT QT_HOST_PATH STREQUAL "")
|
|
|
|
get_filename_component(_qt_platform_host_path_absolute "${QT_HOST_PATH}" ABSOLUTE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if("${QT_HOST_PATH}" STREQUAL "" OR NOT EXISTS "${_qt_platform_host_path_absolute}")
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"To use a cross-compiled Qt, please set the QT_HOST_PATH cache variable to the "
|
|
|
|
"location of your host Qt installation.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# QT_HOST_PATH_CMAKE_DIR is needed to work around the rerooting issue when looking for host
|
|
|
|
# tools. See REROOT_PATH_ISSUE_MARKER.
|
|
|
|
# Prefer initially configured path if none was explicitly set.
|
|
|
|
if(NOT DEFINED QT_HOST_PATH_CMAKE_DIR)
|
|
|
|
if(NOT "${initial_qt_host_path_cmake_dir}" STREQUAL ""
|
|
|
|
AND EXISTS "${initial_qt_host_path_cmake_dir}")
|
|
|
|
set(QT_HOST_PATH_CMAKE_DIR "${initial_qt_host_path_cmake_dir}" CACHE PATH "")
|
|
|
|
else()
|
|
|
|
# First try to auto-compute the location instead of requiring to set
|
|
|
|
# QT_HOST_PATH_CMAKE_DIR explicitly.
|
|
|
|
set(__qt_candidate_host_path_cmake_dir "${QT_HOST_PATH}/lib/cmake")
|
|
|
|
if(__qt_candidate_host_path_cmake_dir
|
|
|
|
AND EXISTS "${__qt_candidate_host_path_cmake_dir}")
|
|
|
|
set(QT_HOST_PATH_CMAKE_DIR
|
|
|
|
"${__qt_candidate_host_path_cmake_dir}" CACHE PATH "")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT QT_HOST_PATH_CMAKE_DIR STREQUAL "")
|
|
|
|
get_filename_component(_qt_platform_host_path_cmake_dir_absolute
|
|
|
|
"${QT_HOST_PATH_CMAKE_DIR}" ABSOLUTE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if("${QT_HOST_PATH_CMAKE_DIR}" STREQUAL ""
|
|
|
|
OR NOT EXISTS "${_qt_platform_host_path_cmake_dir_absolute}")
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"To use a cross-compiled Qt, please set the QT_HOST_PATH_CMAKE_DIR cache variable "
|
|
|
|
"to the location of your host Qt installation lib/cmake directory.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endmacro()
|