From 4dacc099213acf804b50c6e9a9afba5fda8b8e3b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 15 May 2019 14:22:20 +0200 Subject: [PATCH] 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 --- cmake/QtPostProcess.cmake | 6 ++++++ cmake/QtSetup.cmake | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/QtPostProcess.cmake b/cmake/QtPostProcess.cmake index d900f8e88f..b1fb07c394 100644 --- a/cmake/QtPostProcess.cmake +++ b/cmake/QtPostProcess.cmake @@ -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 " diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 187f1bf740..3b02633ed7 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -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)