ffe0889413
To build examples as part of a non-installed Qt prefix build, not-yet-installed Config files need to be found by find_package() calls inside example projects. Facilitate that by propagating the CMAKE_PREFIX_PATH and QT_EXAMPLES_CMAKE_PREFIX_PATH paths in all relevant find_package() calls where NO_DEFAULT_PATH is used. Also adjust the inclusion of the QtFeature.cmake file to be relative to the qt6 directory, rather than the current list directory. This is needed to successfully find the file when parsing a Config file from a non-installed build directory. Change-Id: I36031279628f1f7741d8f4d7571484a6545227f7 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
55 lines
1.8 KiB
CMake
55 lines
1.8 KiB
CMake
# Save old module path, and append a new path that points to the copied over Find modules
|
|
# so that find_dependency() can find the third party packages.
|
|
set(old_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}")
|
|
list(APPEND CMAKE_MODULE_PATH "${_import_prefix}/../@INSTALL_CMAKE_NAMESPACE@")
|
|
list(APPEND CMAKE_MODULE_PATH "${_import_prefix}/../@INSTALL_CMAKE_NAMESPACE@/3rdparty/extra-cmake-modules/find-modules")
|
|
list(APPEND CMAKE_MODULE_PATH "${_import_prefix}/../@INSTALL_CMAKE_NAMESPACE@/3rdparty/kwin")
|
|
|
|
# note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;"
|
|
set(_third_party_deps "@third_party_deps@")
|
|
|
|
foreach(_target_dep ${_third_party_deps})
|
|
list(GET _target_dep 0 pkg)
|
|
list(GET _target_dep 1 version)
|
|
list(GET _target_dep 2 components)
|
|
set(find_package_args "${pkg}")
|
|
if(version)
|
|
list(APPEND find_package_args "${version}")
|
|
endif()
|
|
|
|
if (NOT ${pkg}_FOUND)
|
|
if(components)
|
|
string(REPLACE " " ";" components "${components}")
|
|
find_dependency(${find_package_args} COMPONENTS ${components})
|
|
else()
|
|
find_dependency(${find_package_args})
|
|
endif()
|
|
endif()
|
|
|
|
if (NOT ${pkg}_FOUND)
|
|
set(@target@_FOUND FALSE)
|
|
return()
|
|
endif()
|
|
endforeach()
|
|
|
|
# Restore old module path.
|
|
set(CMAKE_MODULE_PATH "${old_CMAKE_MODULE_PATH}")
|
|
|
|
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
|
|
set(_target_deps "@target_deps@")
|
|
foreach(_target_dep ${_target_deps})
|
|
list(GET _target_dep 0 pkg)
|
|
list(GET _target_dep 1 version)
|
|
|
|
if (NOT ${pkg}_FOUND)
|
|
find_dependency(${pkg} ${version}
|
|
PATHS "${CMAKE_CURRENT_LIST_DIR}/.." ${QT_EXAMPLES_CMAKE_PREFIX_PATH} NO_DEFAULT_PATH
|
|
)
|
|
endif()
|
|
|
|
if (NOT ${pkg}_FOUND)
|
|
set(@target@_FOUND FALSE)
|
|
return()
|
|
endif()
|
|
endforeach()
|