diff options
author | Dāvis Mosāns <davispuh@gmail.com> | 2016-07-07 21:54:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-07-18 13:51:01 (GMT) |
commit | b1f87a50b3aee129d420b8d789ebec55068e4ec5 (patch) | |
tree | e9223617c45d01c60a4c89c5d60dc0121a75a989 /Source/cmSetCommand.cxx | |
parent | 03407040d4d7d89fbb45e941a9dfb4257003a8a8 (diff) | |
download | CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.zip CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.tar.gz CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.tar.bz2 |
Use better KWSys SystemTools::GetEnv and HasEnv signatures
Diffstat (limited to 'Source/cmSetCommand.cxx')
-rw-r--r-- | Source/cmSetCommand.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 1484368..8fb6aa0 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -31,13 +31,14 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args, putEnvArg += "="; // what is the current value if any - const char* currValue = getenv(varName); + std::string currValue; + const bool currValueSet = cmSystemTools::GetEnv(varName, currValue); delete[] varName; // will it be set to something, then set it if (args.size() > 1 && !args[1].empty()) { // but only if it is different from current value - if (!currValue || strcmp(currValue, args[1].c_str())) { + if (!currValueSet || currValue != args[1]) { putEnvArg += args[1]; cmSystemTools::PutEnv(putEnvArg); } @@ -45,7 +46,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args, } // if it will be cleared, then clear it if it isn't already clear - if (currValue) { + if (currValueSet) { cmSystemTools::PutEnv(putEnvArg); } return true; |