summaryrefslogtreecommitdiffstats
path: root/Source/cmSetCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmSetCommand.cxx')
-rw-r--r--Source/cmSetCommand.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 5f4cfee..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;
@@ -59,7 +60,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
// SET (VAR PARENT_SCOPE) // Removes the definition of VAR
// in the parent scope.
else if (args.size() == 2 && args[args.size() - 1] == "PARENT_SCOPE") {
- this->Makefile->RaiseScope(variable, 0);
+ this->Makefile->RaiseScope(variable, CM_NULLPTR);
return true;
}
@@ -73,7 +74,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
bool force = false; // optional
bool parentScope = false;
cmState::CacheEntryType type = cmState::STRING; // required if cache
- const char* docstring = 0; // required if cache
+ const char* docstring = CM_NULLPTR; // required if cache
unsigned int ignoreLastArgs = 0;
// look for PARENT_SCOPE argument