diff options
author | Brad King <brad.king@kitware.com> | 2018-01-25 13:35:23 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-01-25 13:35:28 (GMT) |
commit | 5c724c4ca83059b13e6fd64dad9ee88f59162166 (patch) | |
tree | 09a42c3d5fe1c127386160a830fa693e39de6a86 | |
parent | aaf3c5b32c9e75fb738fcc00228551f678db26d5 (diff) | |
parent | 239a3ef8215416d3fa7d7c1b0bf812b17b3437df (diff) | |
download | CMake-5c724c4ca83059b13e6fd64dad9ee88f59162166.zip CMake-5c724c4ca83059b13e6fd64dad9ee88f59162166.tar.gz CMake-5c724c4ca83059b13e6fd64dad9ee88f59162166.tar.bz2 |
Merge topic 'server-polish-opt-handshake'
239a3ef8 Server-mode: Document protocol version for optional handshake arguments
9b1a3d24 Server-mode: Rename functions to reflect what they do
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1693
-rw-r--r-- | Help/manual/cmake-server.7.rst | 8 | ||||
-rw-r--r-- | Source/cmServerProtocol.cxx | 29 |
2 files changed, 19 insertions, 18 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" ==[ diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index c2dee8f..371d536 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; } } |