Split CreateGeneratorTargets into two methods.

As the generate-time-related API is moving to cmGeneratorTarget, almost
all of generation code needs to be able to access instances of it.
This commit is contained in:
Stephen Kelly 2012-10-06 18:35:37 +02:00
parent b63c71aa35
commit 25f1df3e81
4 changed files with 25 additions and 6 deletions

View File

@ -25,8 +25,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
this->Makefile = this->Target->GetMakefile();
this->LocalGenerator = this->Makefile->GetLocalGenerator();
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
this->ClassifySources();
this->LookupObjectLibraries();
}
//----------------------------------------------------------------------------

View File

@ -74,10 +74,10 @@ public:
bool IsSystemIncludeDirectory(const char *dir, const char *config);
private:
void ClassifySources();
void LookupObjectLibraries();
private:
std::map<std::string, std::vector<std::string> > SystemIncludesCache;
cmGeneratorTarget(cmGeneratorTarget const&);

View File

@ -1058,6 +1058,9 @@ void cmGlobalGenerator::Generate()
this->LocalGenerators[i]->AddHelperCommands();
}
// Create per-target generator information.
this->CreateGeneratorTargets();
// Trace the dependencies, after that no custom commands should be added
// because their dependencies might not be handled correctly
for (i = 0; i < this->LocalGenerators.size(); ++i)
@ -1071,8 +1074,7 @@ void cmGlobalGenerator::Generate()
this->LocalGenerators[i]->GenerateTargetManifest();
}
// Create per-target generator information.
this->CreateGeneratorTargets();
this->ComputeGeneratorTargetObjects();
this->ProcessEvaluationFiles();
@ -1263,7 +1265,6 @@ void cmGlobalGenerator::CreateGeneratorTargets()
cmGeneratorTarget* gt = new cmGeneratorTarget(t);
this->GeneratorTargets[t] = gt;
this->ComputeTargetObjects(gt);
generatorTargets[t] = gt;
}
@ -1280,6 +1281,25 @@ void cmGlobalGenerator::CreateGeneratorTargets()
}
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::ComputeGeneratorTargetObjects()
{
// Construct per-target generator information.
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
cmGeneratorTargetsType targets = mf->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
cmGeneratorTarget* gt = ti->second;
gt->ClassifySources();
gt->LookupObjectLibraries();
this->ComputeTargetObjects(gt);
}
}
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::ClearGeneratorTargets()
{

View File

@ -406,6 +406,7 @@ private:
// Per-target generator information.
cmGeneratorTargetsType GeneratorTargets;
void CreateGeneratorTargets();
void ComputeGeneratorTargetObjects();
void ClearGeneratorTargets();
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;