QtAutogen: Port global generator to cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-10-05 19:21:59 +02:00
parent 1e757c318b
commit b2054e1661
2 changed files with 15 additions and 13 deletions

View File

@ -1251,7 +1251,7 @@ bool cmGlobalGenerator::Compute()
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
// Iterate through all targets and set up automoc for those which have // Iterate through all targets and set up automoc for those which have
// the AUTOMOC, AUTOUIC or AUTORCC property set // the AUTOMOC, AUTOUIC or AUTORCC property set
std::vector<cmTarget const*> autogenTargets = std::vector<cmGeneratorTarget const*> autogenTargets =
this->CreateQtAutoGeneratorsTargets(); this->CreateQtAutoGeneratorsTargets();
#endif #endif
@ -1264,10 +1264,10 @@ bool cmGlobalGenerator::Compute()
} }
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
for (std::vector<cmTarget const*>::iterator it = autogenTargets.begin(); for (std::vector<cmGeneratorTarget const*>::iterator it =
it != autogenTargets.end(); ++it) autogenTargets.begin(); it != autogenTargets.end(); ++it)
{ {
cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(*it); cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget((*it)->Target);
} }
#endif #endif
@ -1403,17 +1403,17 @@ bool cmGlobalGenerator::ComputeTargetDepends()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::vector<const cmTarget*> std::vector<const cmGeneratorTarget*>
cmGlobalGenerator::CreateQtAutoGeneratorsTargets() cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
{ {
std::vector<const cmTarget*> autogenTargets; std::vector<const cmGeneratorTarget*> autogenTargets;
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{ {
cmTargets& targets = cmTargets& targets =
this->LocalGenerators[i]->GetMakefile()->GetTargets(); this->LocalGenerators[i]->GetMakefile()->GetTargets();
std::vector<cmTarget*> filteredTargets; std::vector<cmGeneratorTarget*> filteredTargets;
filteredTargets.reserve(targets.size()); filteredTargets.reserve(targets.size());
for(cmTargets::iterator ti = targets.begin(); for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
@ -1449,16 +1449,18 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
continue; continue;
} }
cmQtAutoGeneratorInitializer::InitializeAutogenSources(&ti->second); cmGeneratorTarget* gt = this->GetGeneratorTarget(&ti->second);
filteredTargets.push_back(&ti->second);
cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt->Target);
filteredTargets.push_back(gt);
} }
for(std::vector<cmTarget*>::iterator ti = filteredTargets.begin(); for(std::vector<cmGeneratorTarget*>::iterator ti = filteredTargets.begin();
ti != filteredTargets.end(); ++ti) ti != filteredTargets.end(); ++ti)
{ {
cmTarget* target = *ti; cmTarget* target = (*ti)->Target;
cmQtAutoGeneratorInitializer::InitializeAutogenTarget( cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
this->LocalGenerators[i], target); this->LocalGenerators[i], target);
autogenTargets.push_back(target); autogenTargets.push_back(*ti);
} }
} }
#endif #endif

View File

@ -384,7 +384,7 @@ protected:
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const; virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const;
std::vector<cmTarget const*> CreateQtAutoGeneratorsTargets(); std::vector<const cmGeneratorTarget*> CreateQtAutoGeneratorsTargets();
std::string SelectMakeProgram(const std::string& makeProgram, std::string SelectMakeProgram(const std::string& makeProgram,
const std::string& makeDefault = "") const; const std::string& makeDefault = "") const;