Combine duplicate code in target property methods

In cmTarget::SetProperty and cmTarget::AppendProperty we check whether
changing the property invalidates cached information.  The check was
duplicated in the two methods, so this commit moves the check into a
helper method called from both.
This commit is contained in:
Brad King 2009-10-05 09:06:44 -04:00
parent 78f0811628
commit daa2f3aa41
2 changed files with 9 additions and 9 deletions

View File

@ -2001,13 +2001,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
} }
this->Properties.SetProperty(prop, value, cmProperty::TARGET); this->Properties.SetProperty(prop, value, cmProperty::TARGET);
this->MaybeInvalidatePropertyCache(prop);
// If imported information is being set, wipe out cached
// information.
if(this->IsImported() && strncmp(prop, "IMPORTED", 8) == 0)
{
this->Internal->ImportInfoMap.clear();
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -2018,9 +2012,13 @@ void cmTarget::AppendProperty(const char* prop, const char* value)
return; return;
} }
this->Properties.AppendProperty(prop, value, cmProperty::TARGET); this->Properties.AppendProperty(prop, value, cmProperty::TARGET);
this->MaybeInvalidatePropertyCache(prop);
}
// If imported information is being set, wipe out cached //----------------------------------------------------------------------------
// information. void cmTarget::MaybeInvalidatePropertyCache(const char* prop)
{
// Wipe wipe out maps caching information affected by this property.
if(this->IsImported() && strncmp(prop, "IMPORTED", 8) == 0) if(this->IsImported() && strncmp(prop, "IMPORTED", 8) == 0)
{ {
this->Internal->ImportInfoMap.clear(); this->Internal->ImportInfoMap.clear();

View File

@ -567,6 +567,8 @@ private:
LinkImplementation& impl); LinkImplementation& impl);
void ComputeLinkClosure(const char* config, LinkClosure& lc); void ComputeLinkClosure(const char* config, LinkClosure& lc);
void MaybeInvalidatePropertyCache(const char* prop);
// The cmMakefile instance that owns this target. This should // The cmMakefile instance that owns this target. This should
// always be set. // always be set.
cmMakefile* Makefile; cmMakefile* Makefile;