summaryrefslogtreecommitdiffstats
path: root/Source/cmSetPropertyCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-07 21:14:41 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-07 21:15:04 (GMT)
commit3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94 (patch)
treed0372265c5b1f07f9b1a8a6cc9bedf96bed2dbcb /Source/cmSetPropertyCommand.cxx
parent9410e24a4ad3a21b2c27d057798f723e88d14d45 (diff)
downloadCMake-3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94.zip
CMake-3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94.tar.gz
CMake-3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94.tar.bz2
Revert topic 'refactor-cache-api'
This topic was never tested without some follow-up commits. The GetCacheEntryValue API returns a pointer to memory freed on return. It will have to be revised along with the rest of the original topic.
Diffstat (limited to 'Source/cmSetPropertyCommand.cxx')
-rw-r--r--Source/cmSetPropertyCommand.cxx19
1 files changed, 8 insertions, 11 deletions
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 77f9fb9..1150bc7 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -452,11 +452,11 @@ bool cmSetPropertyCommand::HandleCacheMode()
// Get the source file.
cmMakefile* mf = this->GetMakefile();
cmake* cm = mf->GetCMakeInstance();
- const char* existingValue
- = cm->GetCacheManager()->GetCacheEntryValue(*ni);
- if(existingValue)
+ cmCacheManager::CacheIterator it =
+ cm->GetCacheManager()->GetCacheIterator(ni->c_str());
+ if(!it.IsAtEnd())
{
- if(!this->HandleCacheEntry(*ni))
+ if(!this->HandleCacheEntry(it))
{
return false;
}
@@ -474,25 +474,22 @@ bool cmSetPropertyCommand::HandleCacheMode()
}
//----------------------------------------------------------------------------
-bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey)
+bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it)
{
// Set or append the property.
const char* name = this->PropertyName.c_str();
const char* value = this->PropertyValue.c_str();
- cmCacheManager* manager = this->Makefile->GetCacheManager();
if (this->Remove)
{
- manager->RemoveCacheEntryProperty(cacheKey, name);
- return true;
+ value = 0;
}
if(this->AppendMode)
{
- manager->AppendCacheEntryProperty(cacheKey, name, value,
- this->AppendAsString);
+ it.AppendProperty(name, value, this->AppendAsString);
}
else
{
- manager->SetCacheEntryProperty(cacheKey, name, value);
+ it.SetProperty(name, value);
}
return true;