VS: Port target depends to cmGeneratorTarget

This commit is contained in:
Stephen Kelly 2015-10-23 18:26:45 +02:00
parent b13e26e278
commit 330bfa8336
5 changed files with 18 additions and 18 deletions

View File

@ -299,7 +299,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
fout << "Package=<5>\n{{{\n}}}\n\n";
fout << "Package=<4>\n";
fout << "{{{\n";
VSDependSet const& depends = this->VSTargetDepends[target->Target];
VSDependSet const& depends = this->VSTargetDepends[target];
for(VSDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{

View File

@ -206,7 +206,7 @@ cmGlobalVisualStudio71Generator
const std::string&,
const char*, cmGeneratorTarget const* target)
{
VSDependSet const& depends = this->VSTargetDepends[target->Target];
VSDependSet const& depends = this->VSTargetDepends[target];
for(VSDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{

View File

@ -730,7 +730,7 @@ cmGlobalVisualStudio7Generator
{
int depcount = 0;
std::string dspguid = this->GetGUID(dspname);
VSDependSet const& depends = this->VSTargetDepends[target->Target];
VSDependSet const& depends = this->VSTargetDepends[target];
for(VSDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{

View File

@ -380,7 +380,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
this->ComputeVSTargetDepends(*(*ti)->Target);
this->ComputeVSTargetDepends(*ti);
}
}
}
@ -394,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
@ -420,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)
if(target->GetType() != cmState::STATIC_LIBRARY)
{
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
@ -460,9 +460,9 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
// 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(gt);
linked = this->GetTargetLinkClosure(target);
}
// Emit link dependencies.

View File

@ -122,9 +122,9 @@ protected:
virtual bool ComputeTargetDepends();
class VSDependSet: public std::set<std::string> {};
class VSDependMap: public std::map<cmTarget const*, VSDependSet> {};
class VSDependMap: public std::map<cmGeneratorTarget const*, VSDependSet> {};
VSDependMap VSTargetDepends;
void ComputeVSTargetDepends(cmTarget&);
void ComputeVSTargetDepends(cmGeneratorTarget *);
bool CheckTargetLinks(cmTarget& target, const std::string& name);
std::string GetUtilityForTarget(cmTarget& target, const std::string&);