Copy Find*.cmake to ${QT_BUILD_DIR}/lib/cmake/Qt6

In top-level builds, when configuring qtsensors, the directory of
FindWMF.cmake isn't in ${CMAKE_MODULE_PATH}, this makes CMake couldn't
find WMF.

On Windows, QtMultimedia requires WMF. If WMF couldn't be found,
QtMultimedia will also be treated as NOT FOUND.

QtSensors has an optional dependency to QtMultimedia. If QtMultimedia
couldn't be found, CMake will warn.

Copy Find*.cmake to ${QT_BUILD_DIR}/lib/cmake/Qt6, to make sure these
files could be found by CMake.

Fixes: QTBUG-95655
Pick-to: 6.2
Change-Id: I87d14c9a7becd0ec493e00c297b2e01fc0ad0f96
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Li Xinwei 2021-08-10 21:19:53 +08:00
parent 41d6a26731
commit 1a8de144b6

View File

@ -451,6 +451,7 @@ macro(qt_build_repo_end)
# Install the repo-specific cmake find modules.
qt_path_join(__qt_repo_install_dir ${QT_CONFIG_INSTALL_DIR} ${INSTALL_CMAKE_NAMESPACE})
qt_path_join(__qt_repo_build_dir ${QT_CONFIG_BUILD_DIR} ${INSTALL_CMAKE_NAMESPACE})
if(NOT PROJECT_NAME STREQUAL "QtBase")
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@ -458,6 +459,12 @@ macro(qt_build_repo_end)
DESTINATION "${__qt_repo_install_dir}"
FILES_MATCHING PATTERN "Find*.cmake"
)
if(QT_SUPERBUILD AND QT_WILL_INSTALL)
file(COPY cmake/
DESTINATION "${__qt_repo_build_dir}"
FILES_MATCHING PATTERN "Find*.cmake"
)
endif()
endif()
endif()