summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudioGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-08-24 22:39:36 (GMT)
committerBrad King <brad.king@kitware.com>2010-08-24 22:39:36 (GMT)
commit325bdb2a92bbbbe18ae2cbffc000bd6e0dd0367a (patch)
tree3c38d59caa8603dca3752306eb44dd7b42c2857a /Source/cmGlobalVisualStudioGenerator.cxx
parent6bea84353c76d392a9da11557ab888fa18ea1955 (diff)
downloadCMake-325bdb2a92bbbbe18ae2cbffc000bd6e0dd0367a.zip
CMake-325bdb2a92bbbbe18ae2cbffc000bd6e0dd0367a.tar.gz
CMake-325bdb2a92bbbbe18ae2cbffc000bd6e0dd0367a.tar.bz2
Factor out duplicate VS target dependency code
Compute VS target dependencies in cmGlobalVisualStudioGenerator when the main global dependency analysis is done. Use these results in each of the VS generators instead of duplicating the analysis.
Diffstat (limited to 'Source/cmGlobalVisualStudioGenerator.cxx')
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx58
1 files changed, 58 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 85b4a71..1007953 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -353,6 +353,64 @@ cmGlobalVisualStudioGenerator::CreateUtilityDependTarget(cmTarget& target)
}
//----------------------------------------------------------------------------
+bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
+{
+ if(!this->cmGlobalGenerator::ComputeTargetDepends())
+ {
+ return false;
+ }
+ std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
+ for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
+ {
+ std::vector<cmLocalGenerator*>& gen = it->second;
+ for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
+ i != gen.end(); ++i)
+ {
+ cmTargets& targets = (*i)->GetMakefile()->GetTargets();
+ for(cmTargets::iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
+ {
+ this->ComputeVSTargetDepends(ti->second);
+ }
+ }
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
+{
+ if(this->VSTargetDepends.find(&target) != this->VSTargetDepends.end())
+ {
+ return;
+ }
+ VSDependSet& vsTargetDepend = this->VSTargetDepends[&target];
+ if(target.GetType() != cmTarget::STATIC_LIBRARY)
+ {
+ cmTarget::LinkLibraryVectorType const& libs = target.GetLinkLibraries();
+ for(cmTarget::LinkLibraryVectorType::const_iterator j = libs.begin();
+ j != libs.end(); ++j)
+ {
+ if(j->first != target.GetName() &&
+ this->FindTarget(0, j->first.c_str()))
+ {
+ vsTargetDepend.insert(j->first);
+ }
+ }
+ }
+ std::set<cmStdString> const& utils = target.GetUtilities();
+ for(std::set<cmStdString>::const_iterator i = utils.begin();
+ i != utils.end(); ++i)
+ {
+ if(*i != target.GetName())
+ {
+ std::string name = this->GetUtilityForTarget(target, i->c_str());
+ vsTargetDepend.insert(name);
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
bool cmGlobalVisualStudioGenerator::CheckTargetLinks(cmTarget& target,
const char* name)
{