From 9b1a3d244b60ae231a161192caf4fe9b40efbdc3 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 24 Jan 2018 16:54:25 +0100 Subject: Server-mode: Rename functions to reflect what they do Rename the test* static functions to getOrTest* to better reflect what they do now. --- Source/cmServerProtocol.cxx | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 4c0a354..a282c5a 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -266,8 +266,8 @@ static void setErrorMessage(std::string* errorMessage, const std::string& text) } } -static bool testHomeDirectory(cmState* state, std::string& value, - std::string* errorMessage) +static bool getOrTestHomeDirectory(cmState* state, std::string& value, + std::string* errorMessage) { const std::string cachedValue = std::string(state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY")); @@ -288,9 +288,10 @@ static bool testHomeDirectory(cmState* state, std::string& value, return true; } -static bool testValue(cmState* state, const std::string& key, - std::string& value, const std::string& keyDescription, - std::string* errorMessage) +static bool getOrTestValue(cmState* state, const std::string& key, + std::string& value, + const std::string& keyDescription, + std::string* errorMessage) { const char* entry = state->GetCacheEntryValue(key); const std::string cachedValue = @@ -337,31 +338,31 @@ bool cmServerProtocol1::DoActivate(const cmServerRequest& request, cmState* state = cm->GetState(); // Check generator: - if (!testValue(state, "CMAKE_GENERATOR", generator, "generator", - errorMessage)) { + if (!getOrTestValue(state, "CMAKE_GENERATOR", generator, "generator", + errorMessage)) { return false; } // check extra generator: - if (!testValue(state, "CMAKE_EXTRA_GENERATOR", extraGenerator, - "extra generator", errorMessage)) { + if (!getOrTestValue(state, "CMAKE_EXTRA_GENERATOR", extraGenerator, + "extra generator", errorMessage)) { return false; } // check sourcedir: - if (!testHomeDirectory(state, sourceDirectory, errorMessage)) { + if (!getOrTestHomeDirectory(state, sourceDirectory, errorMessage)) { return false; } // check toolset: - if (!testValue(state, "CMAKE_GENERATOR_TOOLSET", toolset, "toolset", - errorMessage)) { + if (!getOrTestValue(state, "CMAKE_GENERATOR_TOOLSET", toolset, "toolset", + errorMessage)) { return false; } // check platform: - if (!testValue(state, "CMAKE_GENERATOR_PLATFORM", platform, "platform", - errorMessage)) { + if (!getOrTestValue(state, "CMAKE_GENERATOR_PLATFORM", platform, + "platform", errorMessage)) { return false; } } -- cgit v0.12 From 239a3ef8215416d3fa7d7c1b0bf812b17b3437df Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 24 Jan 2018 17:08:24 +0100 Subject: Server-mode: Document protocol version for optional handshake arguments Document which Protocol version only needs the build directory to be passed during a handshake. This is available a bit earlier than that, but from all I can tell 1.2 is the earliest version where that feature is reliably available. --- Help/manual/cmake-server.7.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index 1ddcb1b..0fed0b1 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -277,10 +277,6 @@ Giving the "major" version of the requested protocol version will make the serve use the latest minor version of that protocol. Use this if you do not explicitly need to depend on a specific minor version. -If the build directory already contains a CMake cache, it is sufficient to set -the "buildDirectory" attribute. To create a fresh build directory, additional -attributes are required depending on the protocol version. - Protocol version 1.0 requires the following attributes to be set: * "sourceDirectory" with a path to the sources @@ -290,6 +286,10 @@ Protocol version 1.0 requires the following attributes to be set: * "platform" with the generator platform (if supported by the generator) * "toolset" with the generator toolset (if supported by the generator) +Protocol version 1.2 makes all but the build directory optional, provided +there is a valid cache in the build directory that contains all the other +information already. + Example:: [== "CMake Server" ==[ -- cgit v0.12