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-11 13:47:59 +0100
commit31c5d50e84b210843ccdec58a86c4fce3125b679 (patch)
treeb7be719d81462646b3b1609e7570dd6ea85ca884 /cmake
parentcc537d927b23a34296767fec8d3885a95f714255 (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>
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 15346d22fc..e129e4c55b 100644
--- a/cmake/QtBuildRepoExamplesHelpers.cmake
+++ b/cmake/QtBuildRepoExamplesHelpers.cmake
@@ -304,6 +304,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.