diff options
Diffstat (limited to 'Source/cmGlobalVisualStudioGenerator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 91ca9a3..b819dad 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -87,7 +87,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() "Build all projects"); cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); - gen[0]->AddGeneratorTarget(allBuild, gt); + gen[0]->AddGeneratorTarget(gt); this->AddGeneratorTarget(allBuild, gt); #if 0 @@ -108,19 +108,20 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() for(std::vector<cmLocalGenerator*>::iterator i = gen.begin(); i != gen.end(); ++i) { - cmGeneratorTargetsType targets = + std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets(); - for(cmGeneratorTargetsType::iterator t = targets.begin(); + for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); t != targets.end(); ++t) { - if (t->second->GetType() == cmState::GLOBAL_TARGET - || t->first->IsImported()) + cmGeneratorTarget* tgt = *t; + if (tgt->GetType() == cmState::GLOBAL_TARGET + || tgt->IsImported()) { continue; } - if(!this->IsExcluded(gen[0], t->second)) + if(!this->IsExcluded(gen[0], tgt)) { - allBuild->AddUtility(t->second->GetName()); + allBuild->AddUtility(tgt->GetName()); } } } @@ -302,19 +303,20 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target, - TargetSet& linked) +void cmGlobalVisualStudioGenerator::FillLinkClosure( + const cmGeneratorTarget *target, + TargetSet& linked) { if(linked.insert(target).second) { - cmGeneratorTarget* gt = this->GetGeneratorTarget(target); - TargetDependSet const& depends = this->GetTargetDirectDepends(gt); + TargetDependSet const& depends = + this->GetTargetDirectDepends(target); for(TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) { if(di->IsLink()) { - this->FillLinkClosure((*di)->Target, linked); + this->FillLinkClosure(*di, linked); } } } @@ -322,7 +324,7 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target, //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::TargetSet const& -cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmTarget* target) +cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target) { TargetSetMap::iterator i = this->TargetLinkClosure.find(target); if(i == this->TargetLinkClosure.end()) @@ -336,7 +338,8 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmTarget* target) //---------------------------------------------------------------------------- void cmGlobalVisualStudioGenerator::FollowLinkDepends( - cmTarget const* target, std::set<cmTarget const*>& linked) + const cmGeneratorTarget *target, + std::set<const cmGeneratorTarget *> &linked) { if(target->GetType() == cmState::INTERFACE_LIBRARY) { @@ -347,14 +350,13 @@ void cmGlobalVisualStudioGenerator::FollowLinkDepends( { // Static library targets do not list their link dependencies so // we must follow them transitively now. - cmGeneratorTarget* gt = this->GetGeneratorTarget(target); - TargetDependSet const& depends = this->GetTargetDirectDepends(gt); + TargetDependSet const& depends = this->GetTargetDirectDepends(target); for(TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) { if(di->IsLink()) { - this->FollowLinkDepends((*di)->Target, linked); + this->FollowLinkDepends(*di, linked); } } } @@ -374,11 +376,11 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() for(std::vector<cmLocalGenerator*>::iterator i = gen.begin(); i != gen.end(); ++i) { - cmTargets& targets = (*i)->GetMakefile()->GetTargets(); - for(cmTargets::iterator ti = targets.begin(); + std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets(); + for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin(); ti != targets.end(); ++ti) { - this->ComputeVSTargetDepends(ti->second); + this->ComputeVSTargetDepends(*ti); } } } @@ -392,13 +394,14 @@ static bool VSLinkable(cmGeneratorTarget const* t) } //---------------------------------------------------------------------------- -void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) +void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( + cmGeneratorTarget* target) { - if(this->VSTargetDepends.find(&target) != this->VSTargetDepends.end()) + if(this->VSTargetDepends.find(target) != this->VSTargetDepends.end()) { return; } - VSDependSet& vsTargetDepend = this->VSTargetDepends[&target]; + VSDependSet& vsTargetDepend = this->VSTargetDepends[target]; // VS <= 7.1 has two behaviors that affect solution dependencies. // // (1) Solution-level dependencies between a linkable target and a @@ -418,19 +421,18 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) // leaving them out for the static library itself but following them // transitively for other targets. - bool allowLinkable = (target.GetType() != cmState::STATIC_LIBRARY && - target.GetType() != cmState::SHARED_LIBRARY && - target.GetType() != cmState::MODULE_LIBRARY && - target.GetType() != cmState::EXECUTABLE); + bool allowLinkable = (target->GetType() != cmState::STATIC_LIBRARY && + target->GetType() != cmState::SHARED_LIBRARY && + target->GetType() != cmState::MODULE_LIBRARY && + target->GetType() != cmState::EXECUTABLE); - cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); - TargetDependSet const& depends = this->GetTargetDirectDepends(gt); + TargetDependSet const& depends = this->GetTargetDirectDepends(target); // Collect implicit link dependencies (target_link_libraries). // Static libraries cannot depend on their link implementation // due to behavior (2), but they do not really need to. - std::set<cmTarget const*> linkDepends; - if(target.GetType() != cmState::STATIC_LIBRARY) + std::set<cmGeneratorTarget const*> linkDepends; + if(target->GetType() != cmState::STATIC_LIBRARY) { for(TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) @@ -438,55 +440,54 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) cmTargetDepend dep = *di; if(dep.IsLink()) { - this->FollowLinkDepends(dep->Target, linkDepends); + this->FollowLinkDepends(*di, linkDepends); } } } // Collect explicit util dependencies (add_dependencies). - std::set<cmTarget const*> utilDepends; + std::set<cmGeneratorTarget const*> utilDepends; for(TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) { cmTargetDepend dep = *di; if(dep.IsUtil()) { - this->FollowLinkDepends(dep->Target, utilDepends); + this->FollowLinkDepends(*di, utilDepends); } } // Collect all targets linked by this target so we can avoid // intermediate targets below. TargetSet linked; - if(target.GetType() != cmState::STATIC_LIBRARY) + if(target->GetType() != cmState::STATIC_LIBRARY) { - linked = this->GetTargetLinkClosure(&target); + linked = this->GetTargetLinkClosure(target); } // Emit link dependencies. - for(std::set<cmTarget const*>::iterator di = linkDepends.begin(); + for(std::set<cmGeneratorTarget const*>::iterator di = linkDepends.begin(); di != linkDepends.end(); ++di) { - cmTarget const* dep = *di; + cmGeneratorTarget const* dep = *di; vsTargetDepend.insert(dep->GetName()); } // Emit util dependencies. Possibly use intermediate targets. - for(std::set<cmTarget const*>::iterator di = utilDepends.begin(); + for(std::set<cmGeneratorTarget const*>::iterator di = utilDepends.begin(); di != utilDepends.end(); ++di) { - cmTarget const* dep = *di; - cmGeneratorTarget* dgt = this->GetGeneratorTarget(dep); - if(allowLinkable || !VSLinkable(dgt) || linked.count(dep)) + cmGeneratorTarget const* dgt = *di; + if(allowLinkable || !VSLinkable(dgt) || linked.count(dgt)) { // Direct dependency allowed. - vsTargetDepend.insert(dep->GetName()); + vsTargetDepend.insert(dgt->GetName()); } else { // Direct dependency on linkable target not allowed. // Use an intermediate utility target. - vsTargetDepend.insert(this->GetUtilityDepend(dep)); + vsTargetDepend.insert(this->GetUtilityDepend(dgt)); } } } @@ -506,7 +507,8 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf) //---------------------------------------------------------------------------- std::string -cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget const* target) +cmGlobalVisualStudioGenerator::GetUtilityDepend( + cmGeneratorTarget const* target) { UtilityDependsMap::iterator i = this->UtilityDepends.find(target); if(i == this->UtilityDepends.end()) @@ -829,10 +831,8 @@ void RegisterVisualStudioMacros(const std::string& macrosFile, } } bool -cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target) +cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmGeneratorTarget const* gt) { - cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); - // check to see if this is a fortran build std::set<std::string> languages; { @@ -891,9 +891,7 @@ cmGlobalVisualStudioGenerator::OrderedTargetDependSet for (TargetSet::const_iterator it = targets.begin(); it != targets.end(); ++it) { - cmGeneratorTarget* gt = - (*it)->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(*it); - this->insert(gt); + this->insert(*it); } } |