diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2016-09-09 08:01:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-26 18:23:53 (GMT) |
commit | 82104cc7a8e831ad20cb87d126c2ff00a851bedc (patch) | |
tree | 79f319287f1f7370676cc69f0280e68fd46e42c1 /Source/cmServerProtocol.cxx | |
parent | 1a5fddfe6d56733528ace3d15899b0739ea28054 (diff) | |
download | CMake-82104cc7a8e831ad20cb87d126c2ff00a851bedc.zip CMake-82104cc7a8e831ad20cb87d126c2ff00a851bedc.tar.gz CMake-82104cc7a8e831ad20cb87d126c2ff00a851bedc.tar.bz2 |
server-mode: Query global configuration of cmake via a command
Add "globalSettings" command that returns:
* Return capability information
* Return currently used generator/extra generator
* Return a range of flags for debug/trace/etc.
Diffstat (limited to 'Source/cmServerProtocol.cxx')
-rw-r--r-- | Source/cmServerProtocol.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 755de0c..49f03cd 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -13,6 +13,7 @@ #include "cmServerProtocol.h" #include "cmExternalMakefileProjectGenerator.h" +#include "cmGlobalGenerator.h" #include "cmServer.h" #include "cmServerDictionary.h" #include "cmSystemTools.h" @@ -279,6 +280,10 @@ const cmServerResponse cmServerProtocol1_0::Process( { assert(this->m_State >= STATE_ACTIVE); + if (request.Type == kGLOBAL_SETTINGS_TYPE) { + return this->ProcessGlobalSettings(request); + } + return request.ReportError("Unknown command!"); } @@ -286,3 +291,32 @@ bool cmServerProtocol1_0::IsExperimental() const { return true; } + +cmServerResponse cmServerProtocol1_0::ProcessGlobalSettings( + const cmServerRequest& request) +{ + cmake* cm = this->CMakeInstance(); + Json::Value obj = Json::objectValue; + + // Capabilities information: + obj[kCAPABILITIES_KEY] = cm->ReportCapabilitiesJson(true); + + obj[kDEBUG_OUTPUT_KEY] = cm->GetDebugOutput(); + obj[kTRACE_KEY] = cm->GetTrace(); + obj[kTRACE_EXPAND_KEY] = cm->GetTraceExpand(); + obj[kWARN_UNINITIALIZED_KEY] = cm->GetWarnUninitialized(); + obj[kWARN_UNUSED_KEY] = cm->GetWarnUnused(); + obj[kWARN_UNUSED_CLI_KEY] = cm->GetWarnUnusedCli(); + obj[kCHECK_SYSTEM_VARS_KEY] = cm->GetCheckSystemVars(); + + obj[kSOURCE_DIRECTORY_KEY] = cm->GetHomeDirectory(); + obj[kBUILD_DIRECTORY_KEY] = cm->GetHomeOutputDirectory(); + + // Currently used generator: + cmGlobalGenerator* gen = cm->GetGlobalGenerator(); + obj[kGENERATOR_KEY] = gen ? gen->GetName() : std::string(); + obj[kEXTRA_GENERATOR_KEY] = + gen ? gen->GetExtraGeneratorName() : std::string(); + + return request.Reply(obj); +} |