Follow the generic logic of QLibraryInfo when computing QT_HOST_PREFIX

After the discussion we concluded that QT_HOST_PREFIX should not
completely replicate the QT_INSTALL_PREFIX behavior.

So this patch implements the following logic if qt.conf is provided:
  1. Prefix is not set
    a. If HostPrefix is not specified, then QT_HOST_PREFIX will be set
       to the folder containing qt.conf.
    b. If HostPrefix is specified and is relative, then QT_HOST_PREFIX
       will be relative to the folder containing qt.conf.
  2. Prefix is set
    a. If HostPrefix is not specified, then QT_HOST_PREFIX will have
       the Prefix value.
    b. If HostPrefix is specified and is relative, then QT_HOST_PREFIX
       will be relative to the folder containing the qt.conf.

The logic might change in a future commit to use the current application
directory instead of qt.conf path, since the use of qt.conf is dictated
by the bootstrap library and this is no longer the case.

Fixes: QTBUG-93707
Change-Id: I5460c97c45924bb8e0c95493afdb9585994c5f28
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2021-05-12 14:15:31 +02:00
parent 07ed2b054a
commit 43ba45151a
1 changed files with 5 additions and 7 deletions

View File

@ -224,15 +224,13 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
: group == EffectivePaths ? "EffectivePaths"
: "Paths"));
ret = config->value(locinfo.key, locinfo.defaultValue).toString();
ret = config->value(locinfo.key).toString();
if (ret.isEmpty()) {
if (loc == HostPrefixPath) {
locinfo = defaultLocationInfo(QLibraryInfo::PrefixPath);
ret = config->value(locinfo.key, locinfo.defaultValue).toString();
} else if (loc == TargetSpecPath || loc == HostSpecPath
|| loc == SysrootifyPrefixPath) {
if (loc == HostPrefixPath || loc == TargetSpecPath || loc == HostSpecPath
|| loc == SysrootifyPrefixPath || loc == QLibraryInfo::PrefixPath) {
fromConf = false;
} else {
ret = locinfo.defaultValue;
}
// The last case here is SysrootPath, which can be legitimately empty.
// All other keys have non-empty fallbacks to start with.