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.
This commit is contained in:
Brad King 2009-10-01 10:26:54 -04:00
parent e8cdd54f74
commit c8ddb6813b
5 changed files with 35 additions and 50 deletions

View File

@ -1931,12 +1931,11 @@ cmGlobalGenerator
std::back_inserter(filenames)); std::back_inserter(filenames));
} }
void //----------------------------------------------------------------------------
cmGlobalGenerator void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
::GetTargetSets(cmGlobalGenerator::TargetDependSet& projectTargets, TargetDependSet& originalTargets,
cmGlobalGenerator::TargetDependSet& originalTargets,
cmLocalGenerator* root, cmLocalGenerator* root,
std::vector<cmLocalGenerator*> const& generators) GeneratorVector const& generators)
{ {
// loop over all local generators // loop over all local generators
for(std::vector<cmLocalGenerator*>::const_iterator i = generators.begin(); for(std::vector<cmLocalGenerator*>::const_iterator i = generators.begin();
@ -1957,26 +1956,22 @@ cmGlobalGenerator
// put the target in the set of original targets // put the target in the set of original targets
originalTargets.insert(target); originalTargets.insert(target);
// Get the set of targets that depend on target // Get the set of targets that depend on target
this->AddTargetDepends(target, this->AddTargetDepends(target, projectTargets);
projectTargets);
} }
} }
} }
void //----------------------------------------------------------------------------
cmGlobalGenerator::AddTargetDepends(cmTarget* target, void cmGlobalGenerator::AddTargetDepends(cmTarget* target,
cmGlobalGenerator::TargetDependSet& TargetDependSet& projectTargets)
projectTargets)
{ {
// add the target itself // add the target itself
if(projectTargets.insert(target).second) if(projectTargets.insert(target).second)
{ {
// This is the first time we have encountered the target. // This is the first time we have encountered the target.
// Recursively follow its dependencies. // Recursively follow its dependencies.
cmGlobalGenerator::TargetDependSet const& tset TargetDependSet const& ts = this->GetTargetDirectDepends(*target);
= this->GetTargetDirectDepends(*target); for(TargetDependSet::const_iterator i = ts.begin(); i != ts.end(); ++i)
for(cmGlobalGenerator::TargetDependSet::const_iterator i =
tset.begin(); i != tset.end(); ++i)
{ {
cmTarget* dtarget = *i; cmTarget* dtarget = *i;
this->AddTargetDepends(dtarget, projectTargets); this->AddTargetDepends(dtarget, projectTargets);

View File

@ -259,15 +259,13 @@ public:
virtual void CreateGUID(const char*) {} virtual void CreateGUID(const char*) {}
protected: protected:
typedef std::vector<cmLocalGenerator*> GeneratorVector;
// for a project collect all its targets by following depend // for a project collect all its targets by following depend
// information, and also collect all the targets // information, and also collect all the targets
void GetTargetSets(cmGlobalGenerator::TargetDependSet& projectTargets, virtual void GetTargetSets(TargetDependSet& projectTargets,
cmGlobalGenerator::TargetDependSet& originalTargets, TargetDependSet& originalTargets,
cmLocalGenerator* root, cmLocalGenerator* root, GeneratorVector const&);
std::vector<cmLocalGenerator*> const& generators); void AddTargetDepends(cmTarget* target, TargetDependSet& projectTargets);
void AddTargetDepends(cmTarget* target,
cmGlobalGenerator::TargetDependSet&
projectTargets);
void SetLanguageEnabledFlag(const char* l, cmMakefile* mf); void SetLanguageEnabledFlag(const char* l, cmMakefile* mf);
void SetLanguageEnabledMaps(const char* l, cmMakefile* mf); void SetLanguageEnabledMaps(const char* l, cmMakefile* mf);
void FillExtensionToLanguageMap(const char* l, cmMakefile* mf); void FillExtensionToLanguageMap(const char* l, cmMakefile* mf);

View File

@ -189,11 +189,9 @@ void cmGlobalVisualStudio6Generator
// Collect all targets under this root generator and the transitive // Collect all targets under this root generator and the transitive
// closure of their dependencies. // closure of their dependencies.
cmGlobalGenerator::TargetDependSet projectTargets; TargetDependSet projectTargets;
cmGlobalGenerator::TargetDependSet originalTargets; TargetDependSet originalTargets;
this->GetTargetSets(projectTargets, this->GetTargetSets(projectTargets, originalTargets, root, generators);
originalTargets,
root, generators);
OrderedTargetDependSet orderedProjectTargets(projectTargets); OrderedTargetDependSet orderedProjectTargets(projectTargets);
std::string rootdir = root->GetMakefile()->GetStartOutputDirectory(); std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();

View File

@ -101,16 +101,13 @@ void cmGlobalVisualStudio71Generator
// Write out the header for a SLN file // Write out the header for a SLN file
this->WriteSLNHeader(fout); this->WriteSLNHeader(fout);
// collect the set of targets for this project by // Collect all targets under this root generator and the transitive
// tracing depends of all targets. // closure of their dependencies.
// also collect the set of targets that are explicitly TargetDependSet projectTargets;
// in this project. TargetDependSet originalTargets;
cmGlobalGenerator::TargetDependSet projectTargets; this->GetTargetSets(projectTargets, originalTargets, root, generators);
cmGlobalGenerator::TargetDependSet originalTargets;
this->GetTargetSets(projectTargets,
originalTargets,
root, generators);
OrderedTargetDependSet orderedProjectTargets(projectTargets); OrderedTargetDependSet orderedProjectTargets(projectTargets);
this->WriteTargetsToSolution(fout, root, orderedProjectTargets); this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
// Write out the configurations information for the solution // Write out the configurations information for the solution
fout << "Global\n"; fout << "Global\n";

View File

@ -353,16 +353,13 @@ void cmGlobalVisualStudio7Generator
// Write out the header for a SLN file // Write out the header for a SLN file
this->WriteSLNHeader(fout); this->WriteSLNHeader(fout);
// collect the set of targets for this project by // Collect all targets under this root generator and the transitive
// tracing depends of all targets. // closure of their dependencies.
// also collect the set of targets that are explicitly TargetDependSet projectTargets;
// in this project. TargetDependSet originalTargets;
cmGlobalGenerator::TargetDependSet projectTargets; this->GetTargetSets(projectTargets, originalTargets, root, generators);
cmGlobalGenerator::TargetDependSet originalTargets;
this->GetTargetSets(projectTargets,
originalTargets,
root, generators);
OrderedTargetDependSet orderedProjectTargets(projectTargets); OrderedTargetDependSet orderedProjectTargets(projectTargets);
this->WriteTargetsToSolution(fout, root, orderedProjectTargets); this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
// Write out the configurations information for the solution // Write out the configurations information for the solution
fout << "Global\n" fout << "Global\n"