aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager/cmaketool.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-07-25 12:49:23 +0200
committerTobias Hunger <tobias.hunger@qt.io>2019-07-25 12:15:32 +0000
commit551d876db3c88b3441be1b63479c7e279248f7db (patch)
tree3650d07e16fec81bd2a31927059feddbf03a5c57 /src/plugins/cmakeprojectmanager/cmaketool.cpp
parent5fea58348140ff194ea2fea501e1fbef028d12d7 (diff)
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>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmaketool.cpp')
-rw-r--r--src/plugins/cmakeprojectmanager/cmaketool.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp
index 3a143f7a1f0..f37939174ac 100644
--- a/src/plugins/cmakeprojectmanager/cmaketool.cpp
+++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp
@@ -594,11 +594,21 @@ void CMakeTool::parseFromCapabilities(const QString &input) const
for (const QVariant &r : requests) {
const QVariantMap object = r.toMap();
const QString kind = object.value("kind").toString();
- const QVariantMap versionObject = object.value("version").toMap();
- const std::pair<int, int> version = std::make_pair(getVersion(versionObject, "major"),
- getVersion(versionObject, "minor"));
- if (!kind.isNull() && version.first != -1 && version.second != -1)
- m_introspection->m_fileApis.append({kind, version});
+ const QVariantList versionList = object.value("version").toList();
+ std::pair<int, int> highestVersion = std::make_pair(-1, -1);
+ for (const QVariant &v : versionList) {
+ const QVariantMap versionObject = v.toMap();
+ 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});
}
}