cmGlobalGenerator: Add global targets at the end of Configure.

Rather than at the start of Generate.
This commit is contained in:
Stephen Kelly 2015-07-25 20:42:28 +02:00
parent 57a69f9341
commit 58811998fb
1 changed files with 27 additions and 12 deletions

View File

@ -1149,6 +1149,25 @@ void cmGlobalGenerator::Configure()
} }
this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1); this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1);
} }
unsigned int i;
// Put a copy of each global target in every directory.
cmTargets globalTargets;
this->CreateDefaultGlobalTargets(&globalTargets);
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
cmTargets* targets = &(mf->GetTargets());
cmTargets::iterator tit;
for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
{
(*targets)[tit->first] = tit->second;
(*targets)[tit->first].SetMakefile(mf);
}
}
} }
void cmGlobalGenerator::CreateGenerationObjects() void cmGlobalGenerator::CreateGenerationObjects()
@ -1222,23 +1241,11 @@ void cmGlobalGenerator::Generate()
this->CreateQtAutoGeneratorsTargets(autogens); this->CreateQtAutoGeneratorsTargets(autogens);
#endif #endif
// For each existing cmLocalGenerator
unsigned int i; unsigned int i;
// Put a copy of each global target in every directory.
cmTargets globalTargets;
this->CreateDefaultGlobalTargets(&globalTargets);
for (i = 0; i < this->LocalGenerators.size(); ++i) for (i = 0; i < this->LocalGenerators.size(); ++i)
{ {
this->LocalGenerators[i]->ComputeObjectMaxPath(); this->LocalGenerators[i]->ComputeObjectMaxPath();
cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
cmTargets* targets = &(mf->GetTargets());
cmTargets::iterator tit;
for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
{
(*targets)[tit->first] = tit->second;
(*targets)[tit->first].SetMakefile(mf);
}
} }
// Add generator specific helper commands // Add generator specific helper commands
@ -1384,6 +1391,10 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
for(cmTargets::iterator ti = targets.begin(); for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
if (ti->second.GetType() == cmTarget::GLOBAL_TARGET)
{
continue;
}
targetNames.push_back(ti->second.GetName()); targetNames.push_back(ti->second.GetName());
} }
for(std::vector<std::string>::iterator ti = targetNames.begin(); for(std::vector<std::string>::iterator ti = targetNames.begin();
@ -1432,6 +1443,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
cmTarget* t = &ti->second; cmTarget* t = &ti->second;
if (t->GetType() == cmTarget::GLOBAL_TARGET)
{
continue;
}
t->AppendBuildInterfaceIncludes(); t->AppendBuildInterfaceIncludes();