From 31c5d50e84b210843ccdec58a86c4fce3125b679 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 6 Mar 2024 15:12:33 +0100 Subject: 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 --- cmake/QtBuildRepoExamplesHelpers.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmake') 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. -- cgit v1.2.3