d4eda5d34d
If we configure module that is already installed it's expected that tests use the build directory to resolve all the depdencies, but not the install directory. This is especially sensetive if the module cmake scripts were changed. This changes the order of find_<package|dependency> PATHS that are used to locate Qt package. QT_EXAMPLES_CMAKE_PREFIX_PATH now is used at first, so we guarantee that we look into the build directory at first place. This trick only works if build directory is added to CMAKE_FIND_ROOT_PATH. The reason for that is the internal CMake logic that tries to relocate the search PATHs and put the paths that are subdirs of or exact CMAKE_FIND_ROOT_PATH higher in search list. Fixes: QTBUG-115730 Change-Id: Icab721f0a6eac7301c626350ab214cc4545b368b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
44 lines
1.8 KiB
CMake
44 lines
1.8 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()
|
|
|
|
# Don't propagate REQUIRED so we don't immediately FATAL_ERROR, rather let the find_dependency calls
|
|
# set _NOT_FOUND_MESSAGE which will be displayed by the includer of the Dependencies file.
|
|
set(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED FALSE)
|
|
|
|
if(NOT @INSTALL_CMAKE_NAMESPACE@_FOUND)
|
|
find_dependency(@INSTALL_CMAKE_NAMESPACE@ @main_qt_package_version@
|
|
PATHS
|
|
${QT_BUILD_CMAKE_PREFIX_PATH}
|
|
"${CMAKE_CURRENT_LIST_DIR}/.."
|
|
"${_qt_cmake_dir}"
|
|
${_qt_additional_packages_prefix_paths}
|
|
${__qt_use_no_default_path_for_qt_packages}
|
|
)
|
|
endif()
|
|
|
|
|
|
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
|
|
set(__qt_@target@_third_party_deps "@third_party_deps@")
|
|
_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_third_party_deps)
|
|
|
|
# Find Qt tool package.
|
|
set(__qt_@target@_tool_deps "@main_module_tool_deps@")
|
|
_qt_internal_find_tool_dependencies("@target@" __qt_@target@_tool_deps)
|
|
|
|
# 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_qt_dependencies("@target@" __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)
|