CMake: Copy FindFoo.cmake scripts to build dir in prefix builds

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 <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2021-12-14 16:56:39 +01:00
parent ac4a913f33
commit 1273ffb000

View File

@ -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