cmGeneratorTarget: Add GetUtilities API

This commit is contained in:
Stephen Kelly 2015-10-23 01:01:46 +02:00
parent f210cb131e
commit 736c2042c6
7 changed files with 14 additions and 8 deletions

View File

@ -796,7 +796,7 @@ std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const
if(!this->UtilityItemsDone) if(!this->UtilityItemsDone)
{ {
this->UtilityItemsDone = true; this->UtilityItemsDone = true;
std::set<std::string> const& utilities = this->Target->GetUtilities(); std::set<std::string> const& utilities = this->GetUtilities();
for(std::set<std::string>::const_iterator i = utilities.begin(); for(std::set<std::string>::const_iterator i = utilities.begin();
i != utilities.end(); ++i) i != utilities.end(); ++i)
{ {
@ -1737,6 +1737,11 @@ const std::vector<std::string>&cmGeneratorTarget::GetLinkDirectories() const
return this->Target->GetLinkDirectories(); return this->Target->GetLinkDirectories();
} }
const std::set<std::string>& cmGeneratorTarget::GetUtilities() const
{
return this->Target->GetUtilities();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const
{ {

View File

@ -186,6 +186,7 @@ public:
const std::vector<std::string>& GetLinkDirectories() const; const std::vector<std::string>& GetLinkDirectories() const;
std::set<std::string>const& GetUtilities() const;
/** Get the macro to define when building sources in this target. /** Get the macro to define when building sources in this target.
If no macro should be defined null is returned. */ If no macro should be defined null is returned. */
const char* GetExportMacro() const; const char* GetExportMacro() const;

View File

@ -965,7 +965,7 @@ cmGlobalNinjaGenerator
if (target->GetType() == cmState::GLOBAL_TARGET) { if (target->GetType() == cmState::GLOBAL_TARGET) {
// Global targets only depend on other utilities, which may not appear in // Global targets only depend on other utilities, which may not appear in
// the TargetDepends set (e.g. "all"). // the TargetDepends set (e.g. "all").
std::set<std::string> const& utils = target->Target->GetUtilities(); std::set<std::string> const& utils = target->GetUtilities();
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs)); std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
} else { } else {
cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target); cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);

View File

@ -235,7 +235,7 @@ void cmGlobalVisualStudio6Generator
std::string project = target->GetName(); std::string project = target->GetName();
std::string location = expath; std::string location = expath;
this->WriteExternalProject(fout, project.c_str(), this->WriteExternalProject(fout, project.c_str(),
location.c_str(), target->Target->GetUtilities()); location.c_str(), target->GetUtilities());
} }
else else
{ {

View File

@ -459,7 +459,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
project.c_str(), project.c_str(),
location.c_str(), location.c_str(),
target->GetProperty("VS_PROJECT_TYPE"), target->GetProperty("VS_PROJECT_TYPE"),
target->Target->GetUtilities()); target->GetUtilities());
written = true; written = true;
} }
else else

View File

@ -464,8 +464,8 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
{ {
// Look for utility dependencies that magically link. // Look for utility dependencies that magically link.
for(std::set<std::string>::const_iterator ui = for(std::set<std::string>::const_iterator ui =
target->Target->GetUtilities().begin(); target->GetUtilities().begin();
ui != target->Target->GetUtilities().end(); ++ui) ui != target->GetUtilities().end(); ++ui)
{ {
if(cmGeneratorTarget* depTarget = if(cmGeneratorTarget* depTarget =
target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str())) target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str()))

View File

@ -1778,8 +1778,8 @@ void cmLocalUnixMakefileGenerator3
{ {
text = "Running external command ..."; text = "Running external command ...";
} }
depends.insert(depends.end(), (*glIt)->Target->GetUtilities().begin(), depends.insert(depends.end(), (*glIt)->GetUtilities().begin(),
(*glIt)->Target->GetUtilities().end()); (*glIt)->GetUtilities().end());
this->AppendEcho(commands, text, this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal); cmLocalUnixMakefileGenerator3::EchoGlobal);