Fix CMAKE_INSTALL_PREFIX when building against installer-provided Qt

When building a module against an installer-provided Qt,
CMAKE_INSTALL_PREFIX would default to /home/qt/work/install, which is
the install prefix of our packaging machines.

Do not hard-code the install prefix in QtBuildInternalsExtra.cmake but
use the one that is calculated from the location of
QtBuildInternalsExtra.cmake.

Pick-to: 6.1
Fixes: QTBUG-90449
Fixes: QTBUG-91475
Change-Id: I39f214efb18796a89f00a171ef190c547bba5c0a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2021-03-02 11:19:36 +01:00
parent aa9b4bd01e
commit e6527e2f73

View File

@ -22,7 +22,7 @@ get_filename_component(QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX
# different installation prefix than the original one. Also allow to opt out via a special variable.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND
NOT QT_BUILD_INTERNALS_NO_FORCE_SET_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" CACHE PATH
set(CMAKE_INSTALL_PREFIX "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}" CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
endif()