summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.cpp7
-rw-r--r--src/corelib/global/qlibraryinfo.cpp35
-rw-r--r--src/corelib/global/qlibraryinfo.h1
3 files changed, 30 insertions, 13 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 897f92a4ea..990554a682 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1553,6 +1553,13 @@ bool qSharedBuild() noexcept
*/
/*!
+ \macro Q_OS_WASM
+ \relates <QtGlobal>
+
+ Defined on Web Assembly.
+*/
+
+/*!
\macro Q_CC_SYM
\relates <QtGlobal>
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index c3eb469767..e82939dcd9 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) {
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 20fd3897f7..ed60b170a5 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -107,6 +107,7 @@ public:
enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths };
static QString rawLocation(LibraryLocation, PathGroup);
static void reload();
+ static void sysrootify(QString *path);
#endif
static QStringList platformPluginArguments(const QString &platformName);