diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-06-17 10:22:53 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-08-13 20:02:30 (GMT) |
commit | 187332b2fa169056a2c3682d9a7628d872b2d49b (patch) | |
tree | bbe993572574f19e478007bd7faf4cf5176df759 /Source/cmServerProtocol.cxx | |
parent | e6ca528be37e8a1058828e4633a7a382fb035157 (diff) | |
download | CMake-187332b2fa169056a2c3682d9a7628d872b2d49b.zip CMake-187332b2fa169056a2c3682d9a7628d872b2d49b.tar.gz CMake-187332b2fa169056a2c3682d9a7628d872b2d49b.tar.bz2 |
cmServerProtocol: fix test of empty values
If a required value is in the cache, it is not necessary to set it
explicitly.
Fixes: #16948, #16988
Diffstat (limited to 'Source/cmServerProtocol.cxx')
-rw-r--r-- | Source/cmServerProtocol.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 7a841a8..606535f 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -269,6 +269,10 @@ static bool testHomeDirectory(cmState* state, std::string& value, { const std::string cachedValue = std::string(state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY")); + if (value.empty()) { + value = cachedValue; + return true; + } const std::string suffix = "/CMakeLists.txt"; const std::string cachedValueCML = cachedValue + suffix; const std::string valueCML = value + suffix; @@ -279,9 +283,6 @@ static bool testHomeDirectory(cmState* state, std::string& value, "source directory value.")); return false; } - if (value.empty()) { - value = cachedValue; - } return true; } @@ -292,15 +293,15 @@ static bool testValue(cmState* state, const std::string& key, const char* entry = state->GetCacheEntryValue(key); const std::string cachedValue = entry == nullptr ? std::string() : std::string(entry); - if (!cachedValue.empty() && !value.empty() && cachedValue != value) { + if (value.empty()) { + value = cachedValue; + } + if (!cachedValue.empty() && cachedValue != value) { setErrorMessage(errorMessage, std::string("\"") + key + "\" is set but incompatible with configured " + keyDescription + " value."); return false; } - if (value.empty()) { - value = cachedValue; - } return true; } |