diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2016-09-13 09:05:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-19 12:57:28 (GMT) |
commit | cd049f012ef22f8f1214b35e351fda823d534b92 (patch) | |
tree | 90b86186bdf037baca230114485ed965d7d215d8 | |
parent | 419ad0510193eb2b2e227095a4dd167cd9b3df80 (diff) | |
download | CMake-cd049f012ef22f8f1214b35e351fda823d534b92.zip CMake-cd049f012ef22f8f1214b35e351fda823d534b92.tar.gz CMake-cd049f012ef22f8f1214b35e351fda823d534b92.tar.bz2 |
cmake-server: Report server mode availablitily in Capabilities
Report the availability of the server-mode in the output of
cmake -E capabilities.
-rw-r--r-- | Source/cmake.cxx | 12 | ||||
-rw-r--r-- | Source/cmake.h | 4 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 112a5f7..0c84283 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -234,7 +234,7 @@ cmake::~cmake() } #if defined(CMAKE_BUILD_WITH_CMAKE) -Json::Value cmake::ReportCapabilitiesJson() const +Json::Value cmake::ReportCapabilitiesJson(bool haveServerMode) const { Json::Value obj = Json::objectValue; // Version information: @@ -280,22 +280,18 @@ Json::Value cmake::ReportCapabilitiesJson() const generators.append(i->second); } obj["generators"] = generators; + obj["serverMode"] = haveServerMode; -#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE - obj["serverMode"] = true; -#else - obj["serverMode"] = false; -#endif return obj; } #endif -std::string cmake::ReportCapabilities() const +std::string cmake::ReportCapabilities(bool haveServerMode) const { std::string result; #if defined(CMAKE_BUILD_WITH_CMAKE) Json::FastWriter writer; - result = writer.write(this->ReportCapabilitiesJson()); + result = writer.write(this->ReportCapabilitiesJson(haveServerMode)); #else result = "Not supported"; #endif diff --git a/Source/cmake.h b/Source/cmake.h index 6095a59..a21c9ca 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -123,9 +123,9 @@ public: ~cmake(); #if defined(CMAKE_BUILD_WITH_CMAKE) - Json::Value ReportCapabilitiesJson() const; + Json::Value ReportCapabilitiesJson(bool haveServerMode) const; #endif - std::string ReportCapabilities() const; + std::string ReportCapabilities(bool haveServerMode) const; static const char* GetCMakeFilesDirectory() { return "/CMakeFiles"; } static const char* GetCMakeFilesDirectoryPostSlash() diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 900bba0..3b385ab 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -527,7 +527,11 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 1; } cmake cm; - std::cout << cm.ReportCapabilities(); +#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE + std::cout << cm.ReportCapabilities(true); +#else + std::cout << cm.ReportCapabilities(false); +#endif return 0; } |