diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-08-13 13:50:48 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-02-01 16:51:00 +0100 |
commit | b954a79e25f15bbce499afaa4304e7ab71648cd5 (patch) | |
tree | 4ee27e974d9612c55d03cd5bc626ed9dfdfd94e0 /cmake/QtInstallHelpers.cmake | |
parent | fb8bd02e635cde8bd72728d343a8f9b29c619f3a (diff) |
CMake: Run export(EXPORT) for prefixed and top-level builds
This is necessary to be able to find Qt6 modules in CMake
ExternalProjects before Qt is installed, regardless of top-level or
per-repo builds.
One use case is examples that are built as ExternalProjects.
Pick-to: 6.2 6.3
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: Ic6a9bfd1c52a04e34b221deab40f419a6fee9463
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtInstallHelpers.cmake')
-rw-r--r-- | cmake/QtInstallHelpers.cmake | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/cmake/QtInstallHelpers.cmake b/cmake/QtInstallHelpers.cmake index 50b2534fba..97a2ecc164 100644 --- a/cmake/QtInstallHelpers.cmake +++ b/cmake/QtInstallHelpers.cmake @@ -18,14 +18,18 @@ function(qt_install) install(${ARGV}) endif() - # Exit early if this is a prefix build. - if(QT_WILL_INSTALL) - return() - endif() - - # In a non-prefix build, when install(EXPORT) is called, - # also call export(EXPORT) to generate build tree target files. + # When install(EXPORT) is called, also call export(EXPORT) + # to generate build tree target files. if(NOT is_install_targets AND arg_EXPORT) + # For prefixed builds (both top-level and per-repo) export build tree CMake Targets files so + # they can be used in CMake ExternalProjects. One such case is examples built as + # ExternalProjects as part of the Qt build. + # In a top-level build the exported config files are placed under qtbase/lib/cmake. + # In a per-repo build, they will be placed in each repo's build dir/lib/cmake. + if(QT_WILL_INSTALL) + qt_path_join(arg_DESTINATION "${QT_BUILD_DIR}" "${arg_DESTINATION}") + endif() + set(namespace_option "") if(arg_NAMESPACE) set(namespace_option NAMESPACE ${arg_NAMESPACE}) |