summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2024-03-06 15:12:33 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2024-03-20 09:57:03 +0100
commit0c38013c71f28015e00b29852a2f20f40aab65c8 (patch)
tree70d6e0d85f932c323da88c767d0396d7e8e55619 /cmake
parenta94fef3e04002f3531b4dfe03088bb3e7b44d2ac (diff)
CMake: Adjust CMAKE_MODULE_PATH for ExternalProject examples
When building EP examples for a repo that defines a bundled library, we need to make sure the relevant FindWrapBundledFooConfigExtra.cmake file is found when looking up dependencies. For a prefix build, that file is placed in the build dir of the repo. Use the list of qt_prefixes that includes the build dir of the repo, append lib/cmake/Qt6 to it and pass that as additional values to the CMAKE_MODULE_PATH variable of the external project. Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: I85d5f360380856fcfb8be7235b8365dcf15aa0c0 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 31c5d50e84b210843ccdec58a86c4fce3125b679) Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuildRepoExamplesHelpers.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmake/QtBuildRepoExamplesHelpers.cmake b/cmake/QtBuildRepoExamplesHelpers.cmake
index 9c243a104d..da8a44e4d0 100644
--- a/cmake/QtBuildRepoExamplesHelpers.cmake
+++ b/cmake/QtBuildRepoExamplesHelpers.cmake
@@ -306,6 +306,12 @@ function(qt_internal_add_example_external_project subdir)
endif()
endif()
+ # We we need to augment the CMAKE_MODULE_PATH with the current repo cmake build dir, to find
+ # files like FindWrapBundledFooConfigExtra.cmake.
+ set(module_paths "${qt_prefixes}")
+ list(TRANSFORM module_paths APPEND "/${INSTALL_LIBDIR}/cmake/${QT_CMAKE_EXPORT_NAMESPACE}")
+ list(APPEND CMAKE_MODULE_PATH ${module_paths})
+
# In multi-config mode by default we exclude building tools for configs other than the main one.
# Trying to build an example in a non-default config using the non-installed
# QtFooConfig.cmake files would error out saying moc is not found.