CMake: Handle super build non-prefix install prefix correctly

The install prefix in such a case is the qtbase build dir,
and not the qt6 top-level build dir. This caused issues with
certain incorrect paths being generated, including a broken
qt-cmake-standalone-test script, as well as upon reconfiguration
determining that a non-prefix build should be installed.

The fix for a non-prefix build is to check explicitly for
the qtbase build dir. This works both for super and non-super
builds.

Task-number: QTBUG-83496
Change-Id: Ida2393176c4c81da767023ff48159afdedfb0a19
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-04-16 20:06:53 +02:00
parent 67ee92f4d8
commit f4cd66ff0a
2 changed files with 4 additions and 2 deletions

View File

@ -308,6 +308,8 @@ endif()
# Compute the values of QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR, QT_CONFIG_INSTALL_DIR
# taking into account whether the current build is a prefix build or a non-prefix build,
# and whether it is a superbuild or non-superbuild.
# A third case is when another module or standalone tests are built against a super-built Qt.
# The layout for the third case is the same as for non-superbuilds.
#
# These values should be prepended to file paths in commands or properties,
# in order to correctly place generated Config files, generated Targets files,

View File

@ -56,7 +56,7 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
# This detection only happens when building qtbase, and later is propagated via the generated
# QtBuildInternalsExtra.cmake file.
if (PROJECT_NAME STREQUAL "QtBase" AND NOT QT_BUILD_STANDALONE_TESTS)
if((CMAKE_INSTALL_PREFIX STREQUAL CMAKE_BINARY_DIR) OR
if((CMAKE_INSTALL_PREFIX STREQUAL QtBase_BINARY_DIR) OR
(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND FEATURE_developer_build))
set(__qt_will_install_value OFF)
@ -64,7 +64,7 @@ if (PROJECT_NAME STREQUAL "QtBase" AND NOT QT_BUILD_STANDALONE_TESTS)
# dir.
# While building another repo (like qtsvg), the CMAKE_INSTALL_PREFIX or CMAKE_PREFIX_PATH
# (either work) should be set on the command line to point to the qtbase build dir.
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH
set(CMAKE_INSTALL_PREFIX ${QtBase_BINARY_DIR} CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
else()
set(__qt_will_install_value ON)