summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraEclipseCDT4Generator.cxx
diff options
context:
space:
mode:
authorDāvis Mosāns <davispuh@gmail.com>2016-07-07 21:54:05 (GMT)
committerBrad King <brad.king@kitware.com>2016-07-18 13:51:01 (GMT)
commitb1f87a50b3aee129d420b8d789ebec55068e4ec5 (patch)
treee9223617c45d01c60a4c89c5d60dc0121a75a989 /Source/cmExtraEclipseCDT4Generator.cxx
parent03407040d4d7d89fbb45e941a9dfb4257003a8a8 (diff)
downloadCMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.zip
CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.tar.gz
CMake-b1f87a50b3aee129d420b8d789ebec55068e4ec5.tar.bz2
Use better KWSys SystemTools::GetEnv and HasEnv signatures
Diffstat (limited to 'Source/cmExtraEclipseCDT4Generator.cxx')
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 16cb082..93c55cc 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -208,7 +208,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
// get the variables from the environment and from the cache and then
// figure out which one to use:
- const char* envVarValue = getenv(envVar);
+ std::string envVarValue;
+ const bool envVarSet = cmSystemTools::GetEnv(envVar, envVarValue);
std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
cacheEntryName += envVar;
@@ -217,17 +218,17 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
// now we have both, decide which one to use
std::string valueToUse;
- if (envVarValue == CM_NULLPTR && cacheValue == CM_NULLPTR) {
+ if (!envVarSet && cacheValue == CM_NULLPTR) {
// nothing known, do nothing
valueToUse = "";
- } else if (envVarValue != CM_NULLPTR && cacheValue == CM_NULLPTR) {
+ } else if (envVarSet && cacheValue == CM_NULLPTR) {
// The variable is in the env, but not in the cache. Use it and put it
// in the cache
valueToUse = envVarValue;
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
cacheEntryName.c_str(), cmState::STRING, true);
mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
- } else if (envVarValue == CM_NULLPTR && cacheValue != CM_NULLPTR) {
+ } else if (!envVarSet && cacheValue != CM_NULLPTR) {
// It is already in the cache, but not in the env, so use it from the cache
valueToUse = cacheValue;
} else {