cmTarget: Remove the project argument to FindTarget

All callers passed 0 in, so just remove the branch.
This commit is contained in:
Ben Boeckel 2014-02-08 11:39:22 -05:00 committed by Brad King
parent 23e9b80f58
commit 8d60da0cb5
9 changed files with 25 additions and 45 deletions

View File

@ -168,7 +168,7 @@ bool cmExportCommand
return false; return false;
} }
if(cmTarget* target = gg->FindTarget(0, currentTarget->c_str())) if(cmTarget* target = gg->FindTarget(currentTarget->c_str()))
{ {
if(target->GetType() == cmTarget::OBJECT_LIBRARY) if(target->GetType() == cmTarget::OBJECT_LIBRARY)
{ {

View File

@ -138,7 +138,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
break; break;
} }
std::string lib = li->first; std::string lib = li->first;
if(cmTarget* libtgt = global->FindTarget(0, lib.c_str())) if(cmTarget* libtgt = global->FindTarget(lib.c_str()))
{ {
// Handle simple output name changes. This command is // Handle simple output name changes. This command is
// deprecated so we do not support full target name // deprecated so we do not support full target name

View File

@ -2070,47 +2070,28 @@ bool cmGlobalGenerator::IsAlias(const std::string& name) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmTarget* cmTarget*
cmGlobalGenerator::FindTarget(const char* project, const std::string& name, cmGlobalGenerator::FindTarget(const std::string& name,
bool excludeAliases) const bool excludeAliases) const
{ {
// if project specific if (!excludeAliases)
if(project)
{ {
std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator std::map<cmStdString, cmTarget*>::const_iterator ai
gens = this->ProjectMap.find(project); = this->AliasTargets.find(name);
for(unsigned int i = 0; i < gens->second.size(); ++i) if (ai != this->AliasTargets.end())
{ {
cmTarget* ret = (gens->second)[i]->GetMakefile()->FindTarget(name, return ai->second;
excludeAliases);
if(ret)
{
return ret;
}
} }
} }
// if all projects/directories std::map<cmStdString,cmTarget *>::const_iterator i =
else this->TotalTargets.find ( name );
if ( i != this->TotalTargets.end() )
{ {
if (!excludeAliases) return i->second;
{ }
std::map<cmStdString, cmTarget*>::const_iterator ai i = this->ImportedTargets.find(name);
= this->AliasTargets.find(name); if ( i != this->ImportedTargets.end() )
if (ai != this->AliasTargets.end()) {
{ return i->second;
return ai->second;
}
}
std::map<cmStdString,cmTarget *>::const_iterator i =
this->TotalTargets.find ( name );
if ( i != this->TotalTargets.end() )
{
return i->second;
}
i = this->ImportedTargets.find(name);
if ( i != this->ImportedTargets.end() )
{
return i->second;
}
} }
return 0; return 0;
} }
@ -2124,7 +2105,7 @@ cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const
return true; return true;
} }
if(cmTarget* tgt = this->FindTarget(0, libname.c_str())) if(cmTarget* tgt = this->FindTarget(libname.c_str()))
{ {
if(tgt->IsFrameworkOnApple()) if(tgt->IsFrameworkOnApple())
{ {

View File

@ -211,7 +211,7 @@ public:
virtual void FindMakeProgram(cmMakefile*); virtual void FindMakeProgram(cmMakefile*);
///! Find a target by name by searching the local generators. ///! Find a target by name by searching the local generators.
cmTarget* FindTarget(const char* project, const std::string& name, cmTarget* FindTarget(const std::string& name,
bool excludeAliases = false) const; bool excludeAliases = false) const;
void AddAlias(const std::string& name, cmTarget *tgt); void AddAlias(const std::string& name, cmTarget *tgt);

View File

@ -440,7 +440,7 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
target.GetUtilities().begin(); target.GetUtilities().begin();
ui != target.GetUtilities().end(); ++ui) ui != target.GetUtilities().end(); ++ui)
{ {
if(cmTarget* depTarget = this->FindTarget(0, ui->c_str())) if(cmTarget* depTarget = this->FindTarget(ui->c_str()))
{ {
if(depTarget->GetType() != cmTarget::INTERFACE_LIBRARY if(depTarget->GetType() != cmTarget::INTERFACE_LIBRARY
&& depTarget->GetProperty("EXTERNAL_MSPROJECT")) && depTarget->GetProperty("EXTERNAL_MSPROJECT"))

View File

@ -1099,7 +1099,7 @@ void cmLocalVisualStudio6Generator
// Compute the proper name to use to link this library. // Compute the proper name to use to link this library.
std::string lib; std::string lib;
std::string libDebug; std::string libDebug;
cmTarget* tgt = this->GlobalGenerator->FindTarget(0, j->first.c_str()); cmTarget* tgt = this->GlobalGenerator->FindTarget(j->first.c_str());
if(tgt) if(tgt)
{ {
lib = cmSystemTools::GetFilenameWithoutExtension lib = cmSystemTools::GetFilenameWithoutExtension

View File

@ -1471,7 +1471,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target,
if ( i != this->Targets.end()) if ( i != this->Targets.end())
{ {
cmTarget* tgt = cmTarget* tgt =
this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(0,lib); this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(lib);
if(tgt) if(tgt)
{ {
// if it is not a static or shared library then you can not link to it // if it is not a static or shared library then you can not link to it
@ -4068,8 +4068,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
} }
// Look for a target built in this project. // Look for a target built in this project.
return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name.c_str(),
name.c_str(),
excludeAliases); excludeAliases);
} }

View File

@ -39,7 +39,7 @@ bool cmTargetLinkLibrariesCommand
// Lookup the target for which libraries are specified. // Lookup the target for which libraries are specified.
this->Target = this->Target =
this->Makefile->GetCMakeInstance() this->Makefile->GetCMakeInstance()
->GetGlobalGenerator()->FindTarget(0, args[0].c_str()); ->GetGlobalGenerator()->FindTarget(args[0].c_str());
if(!this->Target) if(!this->Target)
{ {
cmake::MessageType t = cmake::FATAL_ERROR; // fail by default cmake::MessageType t = cmake::FATAL_ERROR; // fail by default

View File

@ -34,7 +34,7 @@ bool cmTargetPropCommandBase
} }
this->Target = this->Target =
this->Makefile->GetCMakeInstance() this->Makefile->GetCMakeInstance()
->GetGlobalGenerator()->FindTarget(0, args[0].c_str()); ->GetGlobalGenerator()->FindTarget(args[0].c_str());
if(!this->Target) if(!this->Target)
{ {
this->Target = this->Makefile->FindTargetToUse(args[0]); this->Target = this->Makefile->FindTargetToUse(args[0]);