diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d095879ae..a4f3f2f23 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1030,10 +1030,24 @@ void cmTarget::SetMakefile(cmMakefile* mf) //---------------------------------------------------------------------------- void cmTarget::FinishConfigure() { + // Erase any cached link information that might have been comptued + // on-demand during the configuration. This ensures that build + // system generation uses up-to-date information even if other cache + // invalidation code in this source file is buggy. + this->ClearLinkMaps(); + // Do old-style link dependency analysis. this->AnalyzeLibDependencies(*this->Makefile); } +//---------------------------------------------------------------------------- +void cmTarget::ClearLinkMaps() +{ + this->Internal->LinkImplMap.clear(); + this->Internal->LinkInterfaceMap.clear(); + this->Internal->LinkClosureMap.clear(); +} + //---------------------------------------------------------------------------- cmListFileBacktrace const& cmTarget::GetBacktrace() const { @@ -1656,6 +1670,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, tmp.second = llt; this->LinkLibraries.push_back( tmp ); this->OriginalLinkLibraries.push_back(tmp); + this->ClearLinkMaps(); // Add the explicit dependency information for this target. This is // simply a set of libraries separated by ";". There should always @@ -2023,6 +2038,10 @@ void cmTarget::MaybeInvalidatePropertyCache(const char* prop) { this->Internal->ImportInfoMap.clear(); } + if(!this->IsImported() && strncmp(prop, "LINK_INTERFACE_", 15) == 0) + { + this->ClearLinkMaps(); + } } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index db4964581..66e3f3df0 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -567,6 +567,8 @@ private: LinkImplementation& impl); void ComputeLinkClosure(const char* config, LinkClosure& lc); + void ClearLinkMaps(); + void MaybeInvalidatePropertyCache(const char* prop); // The cmMakefile instance that owns this target. This should