summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-10-05 13:06:59 (GMT)
committerBrad King <brad.king@kitware.com>2009-10-05 13:06:59 (GMT)
commit0fb5b2c88c18925fae141a2fcf47a135d710bec4 (patch)
treef886e995ccd020b430ee2ebf9552aece4aa5b115 /Source/cmTarget.cxx
parentdaa2f3aa416b02e4abea0274312a44eca63c5860 (diff)
downloadCMake-0fb5b2c88c18925fae141a2fcf47a135d710bec4.zip
CMake-0fb5b2c88c18925fae141a2fcf47a135d710bec4.tar.gz
CMake-0fb5b2c88c18925fae141a2fcf47a135d710bec4.tar.bz2
Invalidate target link info when necessary
In cmTarget we compute the link implementation, link interface, and link closure structures on-demand and cache the results. This commit teaches cmTarget to invalidate results after a LINK_INTERFACE_* property changes or a new link library is added. We also clear the results at the end of the Configure step to ensure the Generate step uses up-to-date results.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d095879..a4f3f2f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1030,11 +1030,25 @@ 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
{
return this->Internal->Backtrace;
@@ -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();
+ }
}
//----------------------------------------------------------------------------