diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-05-22 14:56:58 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-05-28 12:33:22 +0200 |
commit | 978987981ac1ad0689e042cc241c1732496b59bb (patch) | |
tree | 3ee50e42ea495e3d7efc9d2d011b935428924f34 /src/corelib/global/qlibraryinfo.cpp | |
parent | b9f96cacc99c8a242f45f4581843a6b1c67501f4 (diff) |
Automatically sysrootify $$[FOO/get] properties
If automatic sysrootification is in effect (SysrootifyPrefix=true in
qt.conf) then the qmake property variants $$[FOO] and $$[FOO/get] must
be sysrootified. The latter was never sysrootified.
All other variants (src, dev, raw) are supposed to be without sysroot.
Flesh out a sysrootify function and readabilitify the code a bit while
we're at it.
Fixes: QTBUG-71673
Change-Id: Ifcbce8c035b9da447da9d6937edd5a4aa84573ba
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/corelib/global/qlibraryinfo.cpp')
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 4119012d85..d19e54154e 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -432,7 +432,24 @@ void QLibraryInfo::reload() { QLibraryInfoPrivate::reload(); } -#endif + +void QLibraryInfo::sysrootify(QString *path) +{ + if (!QVariant::fromValue(rawLocation(SysrootifyPrefixPath, FinalPaths)).toBool()) + return; + + const QString sysroot = rawLocation(SysrootPath, FinalPaths); + if (sysroot.isEmpty()) + return; + + if (path->length() > 2 && path->at(1) == QLatin1Char(':') + && (path->at(2) == QLatin1Char('/') || path->at(2) == QLatin1Char('\\'))) { + path->replace(0, 2, sysroot); // Strip out the drive on Windows targets + } else { + path->prepend(sysroot); + } +} +#endif // QT_BUILD_QMAKE /*! Returns the location specified by \a loc. @@ -444,18 +461,8 @@ QLibraryInfo::location(LibraryLocation loc) QString ret = rawLocation(loc, FinalPaths); // Automatically prepend the sysroot to target paths - if (loc < SysrootPath || loc > LastHostPath) { - QString sysroot = rawLocation(SysrootPath, FinalPaths); - if (!sysroot.isEmpty() - && QVariant::fromValue(rawLocation(SysrootifyPrefixPath, FinalPaths)).toBool()) { - if (ret.length() > 2 && ret.at(1) == QLatin1Char(':') - && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\'))) { - ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets - } else { - ret.prepend(sysroot); - } - } - } + if (loc < SysrootPath || loc > LastHostPath) + sysrootify(&ret); return ret; } @@ -598,6 +605,8 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) } else { // we make any other path absolute to the prefix directory baseDir = rawLocation(PrefixPath, group); + if (group == EffectivePaths) + sysrootify(&baseDir); } #else if (loc == PrefixPath) { |