summaryrefslogtreecommitdiffstats
path: root/Source/cmFileAPI.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmFileAPI.cxx')
-rw-r--r--Source/cmFileAPI.cxx42
1 files changed, 42 insertions, 0 deletions
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index 8b98916..8abb5a8 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -978,3 +978,45 @@ Json::Value cmFileAPI::ReportCapabilities()
return capabilities;
}
+
+bool cmFileAPI::AddProjectQuery(cmFileAPI::ObjectKind kind,
+ unsigned majorVersion, unsigned minorVersion)
+{
+ switch (kind) {
+ case ObjectKind::CodeModel:
+ if (majorVersion != 2 || minorVersion > CodeModelV2Minor) {
+ return false;
+ }
+ break;
+ case ObjectKind::Cache:
+ if (majorVersion != 2 || minorVersion > CacheV2Minor) {
+ return false;
+ }
+ break;
+ case ObjectKind::CMakeFiles:
+ if (majorVersion != 1 || minorVersion > CMakeFilesV1Minor) {
+ return false;
+ }
+ break;
+ case ObjectKind::Toolchains:
+ if (majorVersion != 1 || minorVersion > ToolchainsV1Minor) {
+ return false;
+ }
+ break;
+ // These cannot be requested by the project
+ case ObjectKind::ConfigureLog:
+ case ObjectKind::InternalTest:
+ return false;
+ }
+
+ Object query;
+ query.Kind = kind;
+ query.Version = majorVersion;
+ if (std::find(this->TopQuery.Known.begin(), this->TopQuery.Known.end(),
+ query) == this->TopQuery.Known.end()) {
+ this->TopQuery.Known.emplace_back(query);
+ this->QueryExists = true;
+ }
+
+ return true;
+}