diff options
author | Brad King <brad.king@kitware.com> | 2009-10-01 10:26:54 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-10-01 10:26:54 -0400 |
commit | c8ddb6813b5888fa638ed312fca6473028c61aa4 (patch) | |
tree | 591d4fbbe946089a522d0b7a43be6698f478effa | |
parent | e8cdd54f74851f0cc6f1fa544f48304e415ad91d (diff) | |
download | cmake-c8ddb6813b5888fa638ed312fca6473028c61aa4.tar.gz |
Cleanup cmGlobalGenerator::GetTargetSets method
This commit cleans up the declaration, definition, and invocations of
the GetTargetSets method and related code. There is no change in
function except to make the method virtual.
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 31 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 12 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio6Generator.cxx | 8 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio71Generator.cxx | 17 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 17 |
5 files changed, 35 insertions, 50 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 34cbe83d5e..25e7602377 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1931,12 +1931,11 @@ cmGlobalGenerator std::back_inserter(filenames)); } -void -cmGlobalGenerator -::GetTargetSets(cmGlobalGenerator::TargetDependSet& projectTargets, - cmGlobalGenerator::TargetDependSet& originalTargets, - cmLocalGenerator* root, - std::vector<cmLocalGenerator*> const& generators) +//---------------------------------------------------------------------------- +void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets, + TargetDependSet& originalTargets, + cmLocalGenerator* root, + GeneratorVector const& generators) { // loop over all local generators for(std::vector<cmLocalGenerator*>::const_iterator i = generators.begin(); @@ -1949,7 +1948,7 @@ cmGlobalGenerator } cmMakefile* mf = (*i)->GetMakefile(); // Get the targets in the makefile - cmTargets &tgts = mf->GetTargets(); + cmTargets &tgts = mf->GetTargets(); // loop over all the targets for (cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) { @@ -1957,26 +1956,22 @@ cmGlobalGenerator // put the target in the set of original targets originalTargets.insert(target); // Get the set of targets that depend on target - this->AddTargetDepends(target, - projectTargets); + this->AddTargetDepends(target, projectTargets); } } } - -void -cmGlobalGenerator::AddTargetDepends(cmTarget* target, - cmGlobalGenerator::TargetDependSet& - projectTargets) + +//---------------------------------------------------------------------------- +void cmGlobalGenerator::AddTargetDepends(cmTarget* target, + TargetDependSet& projectTargets) { // add the target itself if(projectTargets.insert(target).second) { // This is the first time we have encountered the target. // Recursively follow its dependencies. - cmGlobalGenerator::TargetDependSet const& tset - = this->GetTargetDirectDepends(*target); - for(cmGlobalGenerator::TargetDependSet::const_iterator i = - tset.begin(); i != tset.end(); ++i) + TargetDependSet const& ts = this->GetTargetDirectDepends(*target); + for(TargetDependSet::const_iterator i = ts.begin(); i != ts.end(); ++i) { cmTarget* dtarget = *i; this->AddTargetDepends(dtarget, projectTargets); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index afb639c031..5a01bd29f2 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -259,15 +259,13 @@ public: virtual void CreateGUID(const char*) {} protected: + typedef std::vector<cmLocalGenerator*> GeneratorVector; // for a project collect all its targets by following depend // information, and also collect all the targets - void GetTargetSets(cmGlobalGenerator::TargetDependSet& projectTargets, - cmGlobalGenerator::TargetDependSet& originalTargets, - cmLocalGenerator* root, - std::vector<cmLocalGenerator*> const& generators); - void AddTargetDepends(cmTarget* target, - cmGlobalGenerator::TargetDependSet& - projectTargets); + virtual void GetTargetSets(TargetDependSet& projectTargets, + TargetDependSet& originalTargets, + cmLocalGenerator* root, GeneratorVector const&); + void AddTargetDepends(cmTarget* target, TargetDependSet& projectTargets); void SetLanguageEnabledFlag(const char* l, cmMakefile* mf); void SetLanguageEnabledMaps(const char* l, cmMakefile* mf); void FillExtensionToLanguageMap(const char* l, cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 8c46bd0810..9a7c744867 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -189,11 +189,9 @@ void cmGlobalVisualStudio6Generator // Collect all targets under this root generator and the transitive // closure of their dependencies. - cmGlobalGenerator::TargetDependSet projectTargets; - cmGlobalGenerator::TargetDependSet originalTargets; - this->GetTargetSets(projectTargets, - originalTargets, - root, generators); + TargetDependSet projectTargets; + TargetDependSet originalTargets; + this->GetTargetSets(projectTargets, originalTargets, root, generators); OrderedTargetDependSet orderedProjectTargets(projectTargets); std::string rootdir = root->GetMakefile()->GetStartOutputDirectory(); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 3adc058b0b..c7014aa29f 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -100,17 +100,14 @@ void cmGlobalVisualStudio71Generator { // Write out the header for a SLN file this->WriteSLNHeader(fout); - - // collect the set of targets for this project by - // tracing depends of all targets. - // also collect the set of targets that are explicitly - // in this project. - cmGlobalGenerator::TargetDependSet projectTargets; - cmGlobalGenerator::TargetDependSet originalTargets; - this->GetTargetSets(projectTargets, - originalTargets, - root, generators); + + // Collect all targets under this root generator and the transitive + // closure of their dependencies. + TargetDependSet projectTargets; + TargetDependSet originalTargets; + this->GetTargetSets(projectTargets, originalTargets, root, generators); OrderedTargetDependSet orderedProjectTargets(projectTargets); + this->WriteTargetsToSolution(fout, root, orderedProjectTargets); // Write out the configurations information for the solution fout << "Global\n"; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0cc72cad14..f2f3e988bf 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -352,17 +352,14 @@ void cmGlobalVisualStudio7Generator { // Write out the header for a SLN file this->WriteSLNHeader(fout); - - // collect the set of targets for this project by - // tracing depends of all targets. - // also collect the set of targets that are explicitly - // in this project. - cmGlobalGenerator::TargetDependSet projectTargets; - cmGlobalGenerator::TargetDependSet originalTargets; - this->GetTargetSets(projectTargets, - originalTargets, - root, generators); + + // Collect all targets under this root generator and the transitive + // closure of their dependencies. + TargetDependSet projectTargets; + TargetDependSet originalTargets; + this->GetTargetSets(projectTargets, originalTargets, root, generators); OrderedTargetDependSet orderedProjectTargets(projectTargets); + this->WriteTargetsToSolution(fout, root, orderedProjectTargets); // Write out the configurations information for the solution fout << "Global\n" |