summaryrefslogtreecommitdiffstats
path: root/Source/cmFileAPI.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-10-24 19:22:54 (GMT)
committerBrad King <brad.king@kitware.com>2018-12-12 11:40:10 (GMT)
commit7ee0abbde1656b07eb28ddacca3d22bb7aafdbd8 (patch)
tree6e695983ccdc21351e806feabf6aac7c082e4c7a /Source/cmFileAPI.cxx
parent276fdf299306f83b12bd1cc886f5e37d61f25c59 (diff)
downloadCMake-7ee0abbde1656b07eb28ddacca3d22bb7aafdbd8.zip
CMake-7ee0abbde1656b07eb28ddacca3d22bb7aafdbd8.tar.gz
CMake-7ee0abbde1656b07eb28ddacca3d22bb7aafdbd8.tar.bz2
fileapi: Add helper to create and reference a json reply file
Diffstat (limited to 'Source/cmFileAPI.cxx')
-rw-r--r--Source/cmFileAPI.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index cf772d9..2fa5495 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -175,6 +175,18 @@ std::string cmFileAPI::WriteJsonFile(
return fileName;
}
+Json::Value cmFileAPI::MaybeJsonFile(Json::Value in, std::string const& prefix)
+{
+ Json::Value out;
+ if (in.isObject() || in.isArray()) {
+ out = Json::objectValue;
+ out["jsonFile"] = this->WriteJsonFile(in, prefix);
+ } else {
+ out = std::move(in);
+ }
+ return out;
+}
+
std::string cmFileAPI::ComputeSuffixHash(std::string const& file)
{
cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_256);