cmake-server: Report server mode availablitily in Capabilities
Report the availability of the server-mode in the output of cmake -E capabilities.
This commit is contained in:
parent
419ad05101
commit
cd049f012e
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue