VS: Port ProjectDepends to cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-10-23 18:26:44 +02:00
parent 8ac8739b2e
commit b13e26e278
6 changed files with 18 additions and 17 deletions

View File

@ -175,7 +175,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
<< this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
<< dspname << ext << "\", \"{" << guid << "}\"\n"; << dspname << ext << "\", \"{" << guid << "}\"\n";
fout << "\tProjectSection(ProjectDependencies) = postProject\n"; fout << "\tProjectSection(ProjectDependencies) = postProject\n";
this->WriteProjectDepends(fout, dspname, dir, *t->Target); this->WriteProjectDepends(fout, dspname, dir, t);
fout << "\tEndProjectSection\n"; fout << "\tEndProjectSection\n";
fout <<"EndProject\n"; fout <<"EndProject\n";
@ -204,9 +204,9 @@ void
cmGlobalVisualStudio71Generator cmGlobalVisualStudio71Generator
::WriteProjectDepends(std::ostream& fout, ::WriteProjectDepends(std::ostream& fout,
const std::string&, const std::string&,
const char*, cmTarget const& target) const char*, cmGeneratorTarget const* target)
{ {
VSDependSet const& depends = this->VSTargetDepends[&target]; VSDependSet const& depends = this->VSTargetDepends[target->Target];
for(VSDependSet::const_iterator di = depends.begin(); for(VSDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
{ {
@ -215,7 +215,7 @@ cmGlobalVisualStudio71Generator
if(guid.empty()) if(guid.empty())
{ {
std::string m = "Target: "; std::string m = "Target: ";
m += target.GetName(); m += target->GetName();
m += " depends on unknown target: "; m += " depends on unknown target: ";
m += name; m += name;
cmSystemTools::Error(m.c_str()); cmSystemTools::Error(m.c_str());

View File

@ -62,7 +62,7 @@ protected:
const cmGeneratorTarget *t); const cmGeneratorTarget *t);
virtual void WriteProjectDepends(std::ostream& fout, virtual void WriteProjectDepends(std::ostream& fout,
const std::string& name, const char* path, const std::string& name, const char* path,
cmTarget const& t); cmGeneratorTarget const* t);
virtual void WriteProjectConfigurations( virtual void WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmState::TargetType type, std::ostream& fout, const std::string& name, cmState::TargetType type,
std::vector<std::string> const& configs, std::vector<std::string> const& configs,

View File

@ -533,19 +533,19 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
for(OrderedTargetDependSet::const_iterator tt = for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt) projectTargets.begin(); tt != projectTargets.end(); ++tt)
{ {
cmTarget const* target = (*tt)->Target; cmGeneratorTarget const* target = *tt;
if(target->GetType() == cmState::INTERFACE_LIBRARY) if(target->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
cmMakefile* mf = target->GetMakefile();
const char *vcprojName = const char *vcprojName =
target->GetProperty("GENERATOR_FILE_NAME"); target->GetProperty("GENERATOR_FILE_NAME");
if (vcprojName) if (vcprojName)
{ {
std::string dir = mf->GetCurrentSourceDirectory(); std::string dir = target->GetLocalGenerator()
->GetCurrentSourceDirectory();
this->WriteProjectDepends(fout, vcprojName, this->WriteProjectDepends(fout, vcprojName,
dir.c_str(), *target); dir.c_str(), target);
} }
} }
} }
@ -726,11 +726,11 @@ void
cmGlobalVisualStudio7Generator cmGlobalVisualStudio7Generator
::WriteProjectDepends(std::ostream& fout, ::WriteProjectDepends(std::ostream& fout,
const std::string& dspname, const std::string& dspname,
const char*, cmTarget const& target) const char*, cmGeneratorTarget const* target)
{ {
int depcount = 0; int depcount = 0;
std::string dspguid = this->GetGUID(dspname); std::string dspguid = this->GetGUID(dspname);
VSDependSet const& depends = this->VSTargetDepends[&target]; VSDependSet const& depends = this->VSTargetDepends[target->Target];
for(VSDependSet::const_iterator di = depends.begin(); for(VSDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
{ {
@ -739,7 +739,7 @@ cmGlobalVisualStudio7Generator
if(guid.empty()) if(guid.empty())
{ {
std::string m = "Target: "; std::string m = "Target: ";
m += target.GetName(); m += target->GetName();
m += " depends on unknown target: "; m += " depends on unknown target: ";
m += name; m += name;
cmSystemTools::Error(m.c_str()); cmSystemTools::Error(m.c_str());
@ -748,7 +748,7 @@ cmGlobalVisualStudio7Generator
depcount++; depcount++;
} }
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target); UtilityDependsMap::iterator ui = this->UtilityDepends.find(target->Target);
if(ui != this->UtilityDepends.end()) if(ui != this->UtilityDepends.end())
{ {
const char* uname = ui->second.c_str(); const char* uname = ui->second.c_str();

View File

@ -126,7 +126,7 @@ protected:
const cmGeneratorTarget *t); const cmGeneratorTarget *t);
virtual void WriteProjectDepends(std::ostream& fout, virtual void WriteProjectDepends(std::ostream& fout,
const std::string& name, const char* path, const std::string& name, const char* path,
cmTarget const&t); cmGeneratorTarget const* t);
virtual void WriteProjectConfigurations( virtual void WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmState::TargetType type, std::ostream& fout, const std::string& name, cmState::TargetType type,
std::vector<std::string> const& configs, std::vector<std::string> const& configs,

View File

@ -441,9 +441,9 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::WriteProjectDepends( void cmGlobalVisualStudio8Generator::WriteProjectDepends(
std::ostream& fout, const std::string&, const char*, cmTarget const& t) std::ostream& fout, const std::string&, const char*,
cmGeneratorTarget const* gt)
{ {
cmGeneratorTarget* gt = this->GetGeneratorTarget(&t);
TargetDependSet const& unordered = this->GetTargetDirectDepends(gt); TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
OrderedTargetDependSet depends(unordered, std::string()); OrderedTargetDependSet depends(unordered, std::string());
for(OrderedTargetDependSet::const_iterator i = depends.begin(); for(OrderedTargetDependSet::const_iterator i = depends.begin();

View File

@ -91,7 +91,8 @@ protected:
virtual bool ComputeTargetDepends(); virtual bool ComputeTargetDepends();
virtual void WriteProjectDepends(std::ostream& fout, virtual void WriteProjectDepends(std::ostream& fout,
const std::string& name, const std::string& name,
const char* path, cmTarget const& t); const char* path,
const cmGeneratorTarget *t);
std::string Name; std::string Name;
std::string WindowsCEVersion; std::string WindowsCEVersion;