e044c94a61
When installing conan packages we have one installation prefix per package. When cross-building a conan package, we need to make known those multiple host prefixes to Qt, analogous to QT_ADDITIONAL_PACKAGES_PREFIX_PATH. Pick-to: 6.2 6.3 Fixes: QTBUG-94524 Change-Id: I68cbede350f95266a5fd3559e9b9c214c5858eed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
100 lines
4.3 KiB
CMake
100 lines
4.3 KiB
CMake
# Make sure @INSTALL_CMAKE_NAMESPACE@ is found before anything else.
|
|
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
|
|
|
if("${_qt_cmake_dir}" STREQUAL "")
|
|
set(_qt_cmake_dir "${QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR}")
|
|
endif()
|
|
set(__qt_use_no_default_path_for_qt_packages "NO_DEFAULT_PATH")
|
|
if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
|
|
set(__qt_use_no_default_path_for_qt_packages "")
|
|
endif()
|
|
find_dependency(@INSTALL_CMAKE_NAMESPACE@ @PROJECT_VERSION@
|
|
PATHS
|
|
"${CMAKE_CURRENT_LIST_DIR}/.."
|
|
"${_qt_cmake_dir}"
|
|
${_qt_additional_packages_prefix_paths}
|
|
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
|
|
${__qt_use_no_default_path_for_qt_packages}
|
|
)
|
|
|
|
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
|
|
set(__qt_@target@_third_party_deps "@third_party_deps@")
|
|
|
|
foreach(__qt_@target@_target_dep ${__qt_@target@_third_party_deps})
|
|
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()
|
|
|
|
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()
|
|
|
|
# Find Qt tool package.
|
|
set(__qt_@target@_tool_deps "@main_module_tool_deps@")
|
|
|
|
if(__qt_@target@_tool_deps 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 ${__qt_@target@_tool_deps})
|
|
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()
|
|
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
|
|
list(APPEND __qt_@target@_find_package_args REQUIRED)
|
|
endif()
|
|
find_package(${__qt_@target@_pkg} ${__qt_@target@_version} ${__qt_@target@_find_package_args}
|
|
PATHS
|
|
${_qt_additional_packages_prefix_paths}
|
|
)
|
|
if (NOT ${__qt_@target@_pkg}_FOUND)
|
|
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(__qt_@target@_tool_deps 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()
|
|
|
|
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
|
|
set(__qt_@target@_target_deps "@target_deps@")
|
|
set(__qt_@target@_find_dependency_paths "${CMAKE_CURRENT_LIST_DIR}/.." "${_qt_cmake_dir}")
|
|
_qt_internal_find_dependencies(__qt_@target@_target_deps __qt_@target@_find_dependency_paths)
|
|
|
|
set(_@QT_CMAKE_EXPORT_NAMESPACE@@target@_MODULE_DEPENDENCIES "@qt_module_dependencies@")
|
|
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE)
|