summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-06-07 14:22:34 (GMT)
committerBrad King <brad.king@kitware.com>2019-06-07 15:08:38 (GMT)
commitc932f498426609beb14b9339c2a7dec3ea624998 (patch)
tree42e9db048344d39a576abe368dd111ba2f4afa4d /Source
parent6696855f72adebbb40d475c39dace1e9f855ca2a (diff)
downloadCMake-c932f498426609beb14b9339c2a7dec3ea624998.zip
CMake-c932f498426609beb14b9339c2a7dec3ea624998.tar.gz
CMake-c932f498426609beb14b9339c2a7dec3ea624998.tar.bz2
cmake: Teach -E capabilities to report supported fileapi requests
Fixes: #19339
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileAPI.cxx32
-rw-r--r--Source/cmFileAPI.h3
-rw-r--r--Source/cmake.cxx1
3 files changed, 36 insertions, 0 deletions
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index 9cb484c..ed45398 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -801,3 +801,35 @@ Json::Value cmFileAPI::BuildInternalTest(Object const& object)
}
return test;
}
+
+Json::Value cmFileAPI::ReportCapabilities()
+{
+ Json::Value capabilities = Json::objectValue;
+ Json::Value& requests = capabilities["requests"] = Json::arrayValue;
+
+ {
+ Json::Value request = Json::objectValue;
+ request["kind"] = ObjectKindName(ObjectKind::CodeModel);
+ Json::Value& versions = request["version"] = Json::arrayValue;
+ versions.append(BuildVersion(2, CodeModelV2Minor));
+ requests.append(std::move(request));
+ }
+
+ {
+ Json::Value request = Json::objectValue;
+ request["kind"] = ObjectKindName(ObjectKind::Cache);
+ Json::Value& versions = request["version"] = Json::arrayValue;
+ versions.append(BuildVersion(2, CacheV2Minor));
+ requests.append(std::move(request));
+ }
+
+ {
+ Json::Value request = Json::objectValue;
+ request["kind"] = ObjectKindName(ObjectKind::CMakeFiles);
+ Json::Value& versions = request["version"] = Json::arrayValue;
+ versions.append(BuildVersion(1, CMakeFilesV1Minor));
+ requests.append(std::move(request));
+ }
+
+ return capabilities;
+}
diff --git a/Source/cmFileAPI.h b/Source/cmFileAPI.h
index 1315532..602efa8 100644
--- a/Source/cmFileAPI.h
+++ b/Source/cmFileAPI.h
@@ -36,6 +36,9 @@ public:
and holding the original object. Other JSON types are unchanged. */
Json::Value MaybeJsonFile(Json::Value in, std::string const& prefix);
+ /** Report file-api capabilities for cmake -E capabilities. */
+ static Json::Value ReportCapabilities();
+
private:
cmake* CMakeInstance;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 0dca578..3772f09 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -284,6 +284,7 @@ Json::Value cmake::ReportCapabilitiesJson() const
generators.append(i.second);
}
obj["generators"] = generators;
+ obj["fileApi"] = cmFileAPI::ReportCapabilities();
obj["serverMode"] = true;
return obj;