diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-23 16:26:48 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-24 07:24:43 (GMT) |
commit | 6cac952b9ed8ad202286ddee7246d9ef7ed8f22d (patch) | |
tree | 50a60557bee9ca3bb9179cb14ad3afbfe5df658b | |
parent | 97b3768898431ffff824388dc263654a35a33aa2 (diff) | |
download | CMake-6cac952b9ed8ad202286ddee7246d9ef7ed8f22d.zip CMake-6cac952b9ed8ad202286ddee7246d9ef7ed8f22d.tar.gz CMake-6cac952b9ed8ad202286ddee7246d9ef7ed8f22d.tar.bz2 |
VS: Port interface to cmGeneratorTarget
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 9 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 39 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.h | 18 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 2 |
7 files changed, 39 insertions, 38 deletions
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index bc91e87..6a0e5e9 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -94,7 +94,8 @@ public: /** Return true if the target project file should have the option LinkLibraryDependencies and link to .sln dependencies. */ - virtual bool NeedLinkLibraryDependencies(cmTarget&) { return false; } + virtual bool NeedLinkLibraryDependencies(cmGeneratorTarget*) + { return false; } const char* GetIntelProjectVersion(); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 9b8b9fd..bdb1b25 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -460,14 +460,15 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends( //---------------------------------------------------------------------------- bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( - cmTarget& target) + cmGeneratorTarget *target) { // Look for utility dependencies that magically link. for(std::set<std::string>::const_iterator ui = - target.GetUtilities().begin(); - ui != target.GetUtilities().end(); ++ui) + target->Target->GetUtilities().begin(); + ui != target->Target->GetUtilities().end(); ++ui) { - if(cmTarget* depTarget = this->FindTarget(ui->c_str())) + if(cmGeneratorTarget* depTarget = + target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str())) { if(depTarget->GetType() != cmState::INTERFACE_LIBRARY && depTarget->GetProperty("EXTERNAL_MSPROJECT")) diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index c05e5fa..b3093cc 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -60,7 +60,7 @@ public: /** Return true if the target project file should have the option LinkLibraryDependencies and link to .sln dependencies. */ - virtual bool NeedLinkLibraryDependencies(cmTarget& target); + virtual bool NeedLinkLibraryDependencies(cmGeneratorTarget* target); /** Return true if building for Windows CE */ virtual bool TargetsWindowsCE() const { diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 0ba0ccb..b819dad 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -307,7 +307,7 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure( const cmGeneratorTarget *target, TargetSet& linked) { - if(linked.insert(target->Target).second) + if(linked.insert(target).second) { TargetDependSet const& depends = this->GetTargetDirectDepends(target); @@ -326,10 +326,10 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure( cmGlobalVisualStudioGenerator::TargetSet const& cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target) { - TargetSetMap::iterator i = this->TargetLinkClosure.find(target->Target); + TargetSetMap::iterator i = this->TargetLinkClosure.find(target); if(i == this->TargetLinkClosure.end()) { - TargetSetMap::value_type entry(target->Target, TargetSet()); + TargetSetMap::value_type entry(target, TargetSet()); i = this->TargetLinkClosure.insert(entry).first; this->FillLinkClosure(target, i->second); } @@ -338,7 +338,8 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* 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) { @@ -349,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); } } } @@ -431,7 +431,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( // 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; + std::set<cmGeneratorTarget const*> linkDepends; if(target->GetType() != cmState::STATIC_LIBRARY) { for(TargetDependSet::const_iterator di = depends.begin(); @@ -440,20 +440,20 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( 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); } } @@ -466,23 +466,22 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( } // 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 { @@ -892,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); } } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index c81ddda..f827f26 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -88,7 +88,7 @@ public: /** Return true if building for Windows CE */ virtual bool TargetsWindowsCE() const { return false; } - class TargetSet: public std::set<cmTarget const*> {}; + class TargetSet: public std::set<cmGeneratorTarget const*> {}; class TargetCompare { std::string First; @@ -126,8 +126,9 @@ protected: VSDependMap VSTargetDepends; void ComputeVSTargetDepends(cmGeneratorTarget *); - bool CheckTargetLinks(cmTarget& target, const std::string& name); - std::string GetUtilityForTarget(cmTarget& target, const std::string&); + bool CheckTargetLinks(cmGeneratorTarget& target, const std::string& name); + std::string GetUtilityForTarget(cmGeneratorTarget& target, + const std::string&); virtual std::string WriteUtilityDepend(cmGeneratorTarget const*) = 0; std::string GetUtilityDepend(const cmGeneratorTarget *target); typedef std::map<cmGeneratorTarget const*, std::string> UtilityDependsMap; @@ -141,13 +142,14 @@ private: void PrintCompilerAdvice(std::ostream&, std::string const&, const char*) const {} - void FollowLinkDepends(cmTarget const* target, - std::set<cmTarget const*>& linked); + void FollowLinkDepends(cmGeneratorTarget const* target, + std::set<cmGeneratorTarget const*>& linked); - class TargetSetMap: public std::map<cmTarget*, TargetSet> {}; + class TargetSetMap: public std::map<cmGeneratorTarget*, TargetSet> {}; TargetSetMap TargetLinkClosure; - void FillLinkClosure(cmGeneratorTarget const* target, TargetSet& linked); - TargetSet const& GetTargetLinkClosure(cmGeneratorTarget *target); + void FillLinkClosure(const cmGeneratorTarget *target, + TargetSet& linked); + TargetSet const& GetTargetLinkClosure(cmGeneratorTarget* target); }; class cmGlobalVisualStudioGenerator::OrderedTargetDependSet: diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 5ba59ee..ca8d697 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1186,7 +1186,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; - if(!gg->NeedLinkLibraryDependencies(*target->Target)) + if(!gg->NeedLinkLibraryDependencies(target)) { fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n"; } @@ -1285,7 +1285,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; - if(!gg->NeedLinkLibraryDependencies(*target->Target)) + if(!gg->NeedLinkLibraryDependencies(target)) { fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n"; } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 2bb67fd..9c9f5ab 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2677,7 +2677,7 @@ cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config) this->WriteString("</Link>\n", 2); if(!this->GlobalGenerator->NeedLinkLibraryDependencies( - *this->GeneratorTarget->Target)) + this->GeneratorTarget)) { this->WriteString("<ProjectReference>\n", 2); this->WriteString( |