From 1273ffb0002b14d952807c250dbcc6228f60ff26 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 14 Dec 2021 16:56:39 +0100 Subject: [PATCH] CMake: Copy FindFoo.cmake scripts to build dir in prefix builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They are used by build dir Qt6FooConfig.cmake files in conjunction with export(EXPORT)'ed target files when building ExternalProjects against a non-installed Qt (or in a top-level build). Change-Id: I688caf1bd1b8a8fe7e549cebade2aef6f928bd6c Pick-to: 6.2 6.3 Task-number: QTBUG-90820 Task-number: QTBUG-96232 Reviewed-by: Jörg Bornemann Reviewed-by: Qt CI Bot Reviewed-by: Alexey Edelev --- cmake/QtBaseGlobalTargets.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index a7484a34353..cae5ec8bf64 100644 --- a/cmake/QtBaseGlobalTargets.cmake +++ b/cmake/QtBaseGlobalTargets.cmake @@ -341,6 +341,17 @@ qt_copy_or_install(DIRECTORY cmake/ PATTERN "3rdparty" EXCLUDE ) +# In prefix builds we also need to copy the files into the build config directory, so that the +# build-dir Qt6Config.cmake finds the files when building examples as ExternalProjects. +if(QT_WILL_INSTALL) + file(COPY cmake/ + DESTINATION "${__GlobalConfig_build_dir}" + FILES_MATCHING PATTERN "Find*.cmake" + PATTERN "tests" EXCLUDE + PATTERN "3rdparty" EXCLUDE + ) +endif() + if(MACOS) qt_copy_or_install(FILES cmake/macos/MacOSXBundleInfo.plist.in