diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-02-25 01:24:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-08 18:05:39 (GMT) |
commit | 94fc63e2d5402bc4fa570a92e1f5fe6aba088392 (patch) | |
tree | 1d031c69fe143462a9dc581c8ace15862c89e7ee /Source/cmMakefile.cxx | |
parent | 85fc9f26a703f28b356c93d405446c39bba43846 (diff) | |
download | CMake-94fc63e2d5402bc4fa570a92e1f5fe6aba088392.zip CMake-94fc63e2d5402bc4fa570a92e1f5fe6aba088392.tar.gz CMake-94fc63e2d5402bc4fa570a92e1f5fe6aba088392.tar.bz2 |
stringapi: Use strings for cache iterator values
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e8be29f..a083c78 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1796,7 +1796,8 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, cmCacheManager::CacheEntryType type, bool force) { - const char* val = value; + bool haveVal = value ? true : false; + std::string val = haveVal ? value : ""; cmCacheManager::CacheIterator it = this->GetCacheManager()->GetCacheIterator(name.c_str()); if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) && @@ -1807,6 +1808,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, if(!force) { val = it.GetValue(); + haveVal = true; } if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH ) { @@ -1829,10 +1831,12 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type); val = it.GetValue(); + haveVal = true; } } - this->GetCacheManager()->AddCacheEntry(name, val, doc, type); + this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc, + type); // if there was a definition then remove it this->Internal->VarStack.top().Set(name, 0); } |