summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-08-27 14:02:50 (GMT)
committerBrad King <brad.king@kitware.com>2018-09-21 15:36:11 (GMT)
commitfc43492e44c67ed73a6483a4cd587eae02657949 (patch)
tree753eb35a76045f69729302dfd756a83f7912bf2a /Source
parent227b2be9d6a77efd95c4e99aab8e6255cb95a380 (diff)
downloadCMake-fc43492e44c67ed73a6483a4cd587eae02657949.zip
CMake-fc43492e44c67ed73a6483a4cd587eae02657949.tar.gz
CMake-fc43492e44c67ed73a6483a4cd587eae02657949.tar.bz2
cmake: Factor json version object construction into helper
Diffstat (limited to 'Source')
-rw-r--r--Source/cmake.cxx13
-rw-r--r--Source/cmake.h1
2 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6c14834..c26a380 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -225,10 +225,8 @@ cmake::~cmake()
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
-Json::Value cmake::ReportCapabilitiesJson(bool haveServerMode) const
+Json::Value cmake::ReportVersionJson() const
{
- Json::Value obj = Json::objectValue;
- // Version information:
Json::Value version = Json::objectValue;
version["string"] = CMake_VERSION;
version["major"] = CMake_VERSION_MAJOR;
@@ -236,8 +234,15 @@ Json::Value cmake::ReportCapabilitiesJson(bool haveServerMode) const
version["suffix"] = CMake_VERSION_SUFFIX;
version["isDirty"] = (CMake_VERSION_IS_DIRTY == 1);
version["patch"] = CMake_VERSION_PATCH;
+ return version;
+}
- obj["version"] = version;
+Json::Value cmake::ReportCapabilitiesJson(bool haveServerMode) const
+{
+ Json::Value obj = Json::objectValue;
+
+ // Version information:
+ obj["version"] = this->ReportVersionJson();
// Generators:
std::vector<cmake::GeneratorInfo> generatorInfoList;
diff --git a/Source/cmake.h b/Source/cmake.h
index f7dc3f7..d3d0e80 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -128,6 +128,7 @@ public:
~cmake();
#if defined(CMAKE_BUILD_WITH_CMAKE)
+ Json::Value ReportVersionJson() const;
Json::Value ReportCapabilitiesJson(bool haveServerMode) const;
#endif
std::string ReportCapabilities(bool haveServerMode) const;