From 6696855f72adebbb40d475c39dace1e9f855ca2a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 7 Jun 2019 09:33:11 -0400 Subject: cmake: Simplify implementation of -E capabilities The `cmake -E capabilities` command-line tool is implemented only in a full-featured (non-bootstrap) CMake, and server mode is now always available in this case. --- Source/cmServerProtocol.cxx | 2 +- Source/cmake.cxx | 8 ++++---- Source/cmake.h | 4 ++-- Source/cmcmd.cxx | 6 +----- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index dad8821..558391f 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -630,7 +630,7 @@ cmServerResponse cmServerProtocol1::ProcessGlobalSettings( Json::Value obj = Json::objectValue; // Capabilities information: - obj[kCAPABILITIES_KEY] = cm->ReportCapabilitiesJson(true); + obj[kCAPABILITIES_KEY] = cm->ReportCapabilitiesJson(); obj[kDEBUG_OUTPUT_KEY] = cm->GetDebugOutput(); obj[kTRACE_KEY] = cm->GetTrace(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f0b53f4..0dca578 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -248,7 +248,7 @@ Json::Value cmake::ReportVersionJson() const return version; } -Json::Value cmake::ReportCapabilitiesJson(bool haveServerMode) const +Json::Value cmake::ReportCapabilitiesJson() const { Json::Value obj = Json::objectValue; @@ -284,18 +284,18 @@ Json::Value cmake::ReportCapabilitiesJson(bool haveServerMode) const generators.append(i.second); } obj["generators"] = generators; - obj["serverMode"] = haveServerMode; + obj["serverMode"] = true; return obj; } #endif -std::string cmake::ReportCapabilities(bool haveServerMode) const +std::string cmake::ReportCapabilities() const { std::string result; #if defined(CMAKE_BUILD_WITH_CMAKE) Json::FastWriter writer; - result = writer.write(this->ReportCapabilitiesJson(haveServerMode)); + result = writer.write(this->ReportCapabilitiesJson()); #else result = "Not supported"; #endif diff --git a/Source/cmake.h b/Source/cmake.h index 4de9d28..fa4409a 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -136,9 +136,9 @@ public: #if defined(CMAKE_BUILD_WITH_CMAKE) Json::Value ReportVersionJson() const; - Json::Value ReportCapabilitiesJson(bool haveServerMode) const; + Json::Value ReportCapabilitiesJson() const; #endif - std::string ReportCapabilities(bool haveServerMode) const; + std::string ReportCapabilities() const; //@{ /** diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index a983d30..86082e5 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -734,11 +734,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector const& args) return 1; } cmake cm(cmake::RoleInternal, cmState::Unknown); -#if defined(CMAKE_BUILD_WITH_CMAKE) - std::cout << cm.ReportCapabilities(true); -#else - std::cout << cm.ReportCapabilities(false); -#endif + std::cout << cm.ReportCapabilities(); return 0; } -- cgit v0.12