CMake: Pass CMAKE_MODULE_PATH to external project examples

Some examples depend on FindWrapFoo.cmake scripts that are part of
a repo. An example is qtgrpc with FindWrapProtoc.cmake.

These need to be available when building external project examples in
a prefix build where the repo is not installed yet, and thus the
source dir FindWrap scripts need to be used instead.

Make sure to pass the value of CMAKE_MODULE_PATH to the external
projects to ensure these scripts are found. CMAKE_MODULE_PATH is
populated by qt_set_up_build_internals_paths as part of the
qt repo build.

Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I3e977919bc137ed60e8eb9300625e5d8b87b373e
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 20bd9fad1cf6d41c773056949e334c3ab75e8b1c)
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2023-07-28 10:44:54 +02:00
parent e67704c40f
commit a33732ab74

View File

@ -373,6 +373,7 @@ function(qt_internal_add_example_external_project subdir)
QT_BUILD_CMAKE_PREFIX_PATH:STRING QT_BUILD_CMAKE_PREFIX_PATH:STRING
QT_ADDITIONAL_PACKAGES_PREFIX_PATH:STRING QT_ADDITIONAL_PACKAGES_PREFIX_PATH:STRING
CMAKE_FIND_ROOT_PATH:STRING CMAKE_FIND_ROOT_PATH:STRING
CMAKE_MODULE_PATH:STRING
BUILD_SHARED_LIBS:BOOL BUILD_SHARED_LIBS:BOOL
CMAKE_OSX_ARCHITECTURES:STRING CMAKE_OSX_ARCHITECTURES:STRING
CMAKE_OSX_DEPLOYMENT_TARGET:STRING CMAKE_OSX_DEPLOYMENT_TARGET:STRING