forked from qt-creator/qt-creator
CMake: Fix fileApi detection
Fix fileApi detection: It returns a list of versions in -E capabilities output, not just one version. Change-Id: I94a59806f3c4577b01342cae6f05cdc8385131a8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
@@ -594,11 +594,21 @@ void CMakeTool::parseFromCapabilities(const QString &input) const
|
|||||||
for (const QVariant &r : requests) {
|
for (const QVariant &r : requests) {
|
||||||
const QVariantMap object = r.toMap();
|
const QVariantMap object = r.toMap();
|
||||||
const QString kind = object.value("kind").toString();
|
const QString kind = object.value("kind").toString();
|
||||||
const QVariantMap versionObject = object.value("version").toMap();
|
const QVariantList versionList = object.value("version").toList();
|
||||||
const std::pair<int, int> version = std::make_pair(getVersion(versionObject, "major"),
|
std::pair<int, int> highestVersion = std::make_pair(-1, -1);
|
||||||
getVersion(versionObject, "minor"));
|
for (const QVariant &v : versionList) {
|
||||||
if (!kind.isNull() && version.first != -1 && version.second != -1)
|
const QVariantMap versionObject = v.toMap();
|
||||||
m_introspection->m_fileApis.append({kind, version});
|
const std::pair<int, int> version = std::make_pair(getVersion(versionObject,
|
||||||
|
"major"),
|
||||||
|
getVersion(versionObject,
|
||||||
|
"minor"));
|
||||||
|
if (version.first > highestVersion.first
|
||||||
|
|| (version.first == highestVersion.first
|
||||||
|
&& version.second > highestVersion.second))
|
||||||
|
highestVersion = version;
|
||||||
|
}
|
||||||
|
if (!kind.isNull() && highestVersion.first != -1 && highestVersion.second != -1)
|
||||||
|
m_introspection->m_fileApis.append({kind, highestVersion});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user