diff options
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/library/qmakeglobals.cpp | 57 | ||||
-rw-r--r-- | qmake/library/qmakeglobals.h | 1 |
2 files changed, 38 insertions, 20 deletions
diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp index cab04fc239..452b44c045 100644 --- a/qmake/library/qmakeglobals.cpp +++ b/qmake/library/qmakeglobals.cpp @@ -327,6 +327,13 @@ bool QMakeGlobals::initProperties() QT_PCLOSE(proc); } #endif + parseProperties(data, properties); + return true; +} +#endif + +void QMakeGlobals::parseProperties(const QByteArray &data, QHash<ProKey, ProString> &properties) +{ const auto lines = data.split('\n'); for (QByteArray line : lines) { int off = line.indexOf(':'); @@ -337,40 +344,50 @@ bool QMakeGlobals::initProperties() QString name = QString::fromLatin1(line.left(off)); ProString value = ProString(QDir::fromNativeSeparators( QString::fromLocal8Bit(line.mid(off + 1)))); + if (value.isNull()) + value = ProString(""); // Make sure it is not null, to discern from missing keys properties.insert(ProKey(name), value); if (name.startsWith(QLatin1String("QT_"))) { - bool plain = !name.contains(QLatin1Char('/')); - if (!plain) { - if (!name.endsWith(QLatin1String("/get"))) + enum { PropPut, PropRaw, PropGet } variant; + if (name.contains(QLatin1Char('/'))) { + if (name.endsWith(QLatin1String("/raw"))) + variant = PropRaw; + else if (name.endsWith(QLatin1String("/get"))) + variant = PropGet; + else // Nothing falls back on /src or /dev. continue; name.chop(4); + } else { + variant = PropPut; } if (name.startsWith(QLatin1String("QT_INSTALL_"))) { - if (plain) { - properties.insert(ProKey(name + QLatin1String("/raw")), value); - properties.insert(ProKey(name + QLatin1String("/get")), value); - } - properties.insert(ProKey(name + QLatin1String("/src")), value); - if (name == QLatin1String("QT_INSTALL_PREFIX") - || name == QLatin1String("QT_INSTALL_DATA") - || name == QLatin1String("QT_INSTALL_BINS")) { - name.replace(3, 7, QLatin1String("HOST")); - if (plain) { - properties.insert(ProKey(name), value); - properties.insert(ProKey(name + QLatin1String("/get")), value); + if (variant < PropRaw) { + if (name == QLatin1String("QT_INSTALL_PREFIX") + || name == QLatin1String("QT_INSTALL_DATA") + || name == QLatin1String("QT_INSTALL_LIBS") + || name == QLatin1String("QT_INSTALL_BINS")) { + // Qt4 fallback + QString hname = name; + hname.replace(3, 7, QLatin1String("HOST")); + properties.insert(ProKey(hname), value); + properties.insert(ProKey(hname + QLatin1String("/get")), value); + properties.insert(ProKey(hname + QLatin1String("/src")), value); } - properties.insert(ProKey(name + QLatin1String("/src")), value); + properties.insert(ProKey(name + QLatin1String("/raw")), value); } - } else if (name.startsWith(QLatin1String("QT_HOST_"))) { - if (plain) + if (variant <= PropRaw) + properties.insert(ProKey(name + QLatin1String("/dev")), value); + } else if (!name.startsWith(QLatin1String("QT_HOST_"))) { + continue; + } + if (variant != PropRaw) { + if (variant < PropGet) properties.insert(ProKey(name + QLatin1String("/get")), value); properties.insert(ProKey(name + QLatin1String("/src")), value); } } } - return true; } -#endif #endif // QT_BUILD_QMAKE QT_END_NAMESPACE diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h index cf71a5afda..6c00b1f3af 100644 --- a/qmake/library/qmakeglobals.h +++ b/qmake/library/qmakeglobals.h @@ -131,6 +131,7 @@ public: void reloadProperties() { property->reload(); } ProString propertyValue(const ProKey &name) const { return property->value(name); } #else + static void parseProperties(const QByteArray &data, QHash<ProKey, ProString> &props); # ifdef PROEVALUATOR_INIT_PROPS bool initProperties(); # else |