Save and set the CMAKE_INSTALL_PREFIX in BuildInternal's Config file

Once qtbase is built and installed, save the CMAKE_INSTALL_PREFIX
that was used during the build, and set it when a consumer calls
find_package(Qt5BuildInternals).

This fixes a bug where syncqt can not be found when building qtsvg,
while the developer specifies CMAKE_PREFIX_PATH to find the Qt packages,
but does not set the CMAKE_INSTALL_PREFIX.

Task-number: QTBUG-75544
Change-Id: I03fd23ba418af5115105610f3f9ed92664562945
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-05-15 14:22:20 +02:00
parent 9542e78525
commit 4dacc09921
2 changed files with 8 additions and 2 deletions

View File

@ -176,6 +176,12 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
string(APPEND QT_BUILD_INTERNALS_EXTRA_CMAKE_CODE "
set(QT_BUILD_INTERNALS_PATH \"\${CMAKE_CURRENT_LIST_DIR}\")")
# Propagate the original install prefix, so that a developer building a child module can
# specify CMAKE_PREFIX_PATH for finding the Qt modules instead of CMAKE_INSTALL_PREFIX.
string(APPEND QT_BUILD_INTERNALS_EXTRA_CMAKE_CODE "
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH
\"Install path prefix, prepended onto install directories.\" FORCE)")
# Propagate developer builds to other modules via BuildInternals package.
if(FEATURE_developer_build)
string(APPEND QT_BUILD_INTERNALS_EXTRA_CMAKE_CODE "

View File

@ -41,8 +41,8 @@ if(FEATURE_developer_build)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
else()
# No-op. While building another module, the CMAKE_INSTALL_PREFIX should be set on the
# command line to point to the qtbase build dir.
# No-op. While building another module, the CMAKE_INSTALL_PREFIX or CMAKE_PREFIX_PATH
# (either work) should be set on the command line to point to the qtbase build dir.
endif()
else()
set(QT_WILL_INSTALL ON)