cmMakefile: make some methods take const std::string& instead of const char*
Most callers already have a std::string, on which they called c_str() to pass it into these methods, which internally converted it back to std::string. Pass a std::string directly to these methods now, avoiding all these conversions. Those methods that only pass in a const char* will get the conversion to std::string now only once.
This commit is contained in:
parent
4c7bac45ae
commit
c768e398f9
|
@ -24,14 +24,14 @@ bool cmAddDependenciesCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string target_name = args[0];
|
std::string target_name = args[0];
|
||||||
if(this->Makefile->IsAlias(target_name.c_str()))
|
if(this->Makefile->IsAlias(target_name))
|
||||||
{
|
{
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "Cannot add target-level dependencies to alias target \""
|
e << "Cannot add target-level dependencies to alias target \""
|
||||||
<< target_name << "\".\n";
|
<< target_name << "\".\n";
|
||||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
}
|
}
|
||||||
if(cmTarget* target = this->Makefile->FindTargetToUse(target_name.c_str()))
|
if(cmTarget* target = this->Makefile->FindTargetToUse(target_name))
|
||||||
{
|
{
|
||||||
if (target->GetType() == cmTarget::INTERFACE_LIBRARY)
|
if (target->GetType() == cmTarget::INTERFACE_LIBRARY)
|
||||||
{
|
{
|
||||||
|
|
|
@ -201,7 +201,7 @@ bool cmAddExecutableCommand
|
||||||
if(importTarget)
|
if(importTarget)
|
||||||
{
|
{
|
||||||
// Make sure the target does not already exist.
|
// Make sure the target does not already exist.
|
||||||
if(this->Makefile->FindTargetToUse(exename.c_str()))
|
if(this->Makefile->FindTargetToUse(exename))
|
||||||
{
|
{
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "cannot create imported target \"" << exename
|
e << "cannot create imported target \"" << exename
|
||||||
|
|
|
@ -363,7 +363,7 @@ bool cmAddLibraryCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the target does not already exist.
|
// Make sure the target does not already exist.
|
||||||
if(this->Makefile->FindTargetToUse(libName.c_str()))
|
if(this->Makefile->FindTargetToUse(libName))
|
||||||
{
|
{
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "cannot create imported target \"" << libName
|
e << "cannot create imported target \"" << libName
|
||||||
|
|
|
@ -411,7 +411,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
|
||||||
i != utils.end(); ++i)
|
i != utils.end(); ++i)
|
||||||
{
|
{
|
||||||
if(cmTarget const* transitive_dependee =
|
if(cmTarget const* transitive_dependee =
|
||||||
dependee->GetMakefile()->FindTargetToUse(i->c_str()))
|
dependee->GetMakefile()->FindTargetToUse(*i))
|
||||||
{
|
{
|
||||||
this->AddTargetDepend(depender_index, transitive_dependee, false);
|
this->AddTargetDepend(depender_index, transitive_dependee, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
|
||||||
else if(doing == DoingLinkLibraries)
|
else if(doing == DoingLinkLibraries)
|
||||||
{
|
{
|
||||||
libsToLink += "\"" + cmSystemTools::TrimWhitespace(argv[i]) + "\" ";
|
libsToLink += "\"" + cmSystemTools::TrimWhitespace(argv[i]) + "\" ";
|
||||||
if(cmTarget *tgt = this->Makefile->FindTargetToUse(argv[i].c_str()))
|
if(cmTarget *tgt = this->Makefile->FindTargetToUse(argv[i]))
|
||||||
{
|
{
|
||||||
switch(tgt->GetType())
|
switch(tgt->GetType())
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const
|
||||||
std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
|
std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
|
||||||
{
|
{
|
||||||
std::string const& argv0 = this->CC.GetCommandLines()[c][0];
|
std::string const& argv0 = this->CC.GetCommandLines()[c][0];
|
||||||
cmTarget* target = this->Makefile->FindTargetToUse(argv0.c_str());
|
cmTarget* target = this->Makefile->FindTargetToUse(argv0);
|
||||||
if(target && target->GetType() == cmTarget::EXECUTABLE &&
|
if(target && target->GetType() == cmTarget::EXECUTABLE &&
|
||||||
(target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING")))
|
(target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING")))
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
||||||
tei = targets.begin();
|
tei = targets.begin();
|
||||||
tei != targets.end(); ++tei)
|
tei != targets.end(); ++tei)
|
||||||
{
|
{
|
||||||
cmTarget *te = this->Makefile->FindTargetToUse(tei->c_str());
|
cmTarget *te = this->Makefile->FindTargetToUse(*tei);
|
||||||
expectedTargets += sep + this->Namespace + te->GetExportName();
|
expectedTargets += sep + this->Namespace + te->GetExportName();
|
||||||
sep = " ";
|
sep = " ";
|
||||||
if(this->ExportedTargets.insert(te).second)
|
if(this->ExportedTargets.insert(te).second)
|
||||||
|
|
|
@ -159,7 +159,7 @@ bool cmExportCommand
|
||||||
currentTarget != this->Targets.GetVector().end();
|
currentTarget != this->Targets.GetVector().end();
|
||||||
++currentTarget)
|
++currentTarget)
|
||||||
{
|
{
|
||||||
if (this->Makefile->IsAlias(currentTarget->c_str()))
|
if (this->Makefile->IsAlias(*currentTarget))
|
||||||
{
|
{
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "given ALIAS target \"" << *currentTarget
|
e << "given ALIAS target \"" << *currentTarget
|
||||||
|
|
|
@ -534,7 +534,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
|
||||||
{
|
{
|
||||||
cmMakefile *mf = target->GetMakefile();
|
cmMakefile *mf = target->GetMakefile();
|
||||||
|
|
||||||
cmTarget *tgt = mf->FindTargetToUse(input.c_str());
|
cmTarget *tgt = mf->FindTargetToUse(input);
|
||||||
if (!tgt)
|
if (!tgt)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -109,7 +109,7 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
|
||||||
for(std::vector<std::string>::const_iterator li = depends.begin();
|
for(std::vector<std::string>::const_iterator li = depends.begin();
|
||||||
li != depends.end(); ++li)
|
li != depends.end(); ++li)
|
||||||
{
|
{
|
||||||
cmTarget *tgt = target->GetMakefile()->FindTargetToUse(li->c_str());
|
cmTarget *tgt = target->GetMakefile()->FindTargetToUse(*li);
|
||||||
if(tgt && emitted.insert(tgt).second)
|
if(tgt && emitted.insert(tgt).second)
|
||||||
{
|
{
|
||||||
this->Exports.push_back(tgt);
|
this->Exports.push_back(tgt);
|
||||||
|
|
|
@ -120,7 +120,7 @@ void cmFLTKWrapUICommand::FinalPass()
|
||||||
// people should add the srcs to the target themselves, but the old command
|
// people should add the srcs to the target themselves, but the old command
|
||||||
// didn't support that, so check and see if they added the files in and if
|
// didn't support that, so check and see if they added the files in and if
|
||||||
// they didn;t then print a warning and add then anyhow
|
// they didn;t then print a warning and add then anyhow
|
||||||
cmTarget* target = this->Makefile->FindTarget(this->Target.c_str());
|
cmTarget* target = this->Makefile->FindTarget(this->Target);
|
||||||
if(!target)
|
if(!target)
|
||||||
{
|
{
|
||||||
std::string msg =
|
std::string msg =
|
||||||
|
|
|
@ -822,7 +822,7 @@ std::string getLinkedTargetsContent(const std::vector<std::string> &libraries,
|
||||||
// self-referencing loop.
|
// self-referencing loop.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (context->Makefile->FindTargetToUse(it->c_str()))
|
if (context->Makefile->FindTargetToUse(*it))
|
||||||
{
|
{
|
||||||
depString +=
|
depString +=
|
||||||
sep + "$<TARGET_PROPERTY:" + *it + "," + interfacePropertyName + ">";
|
sep + "$<TARGET_PROPERTY:" + *it + "," + interfacePropertyName + ">";
|
||||||
|
@ -912,18 +912,16 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
}
|
}
|
||||||
if(propertyName == "ALIASED_TARGET")
|
if(propertyName == "ALIASED_TARGET")
|
||||||
{
|
{
|
||||||
if(context->Makefile->IsAlias(targetName.c_str()))
|
if(context->Makefile->IsAlias(targetName))
|
||||||
{
|
{
|
||||||
if(cmTarget* tgt =
|
if(cmTarget* tgt = context->Makefile->FindTargetToUse(targetName))
|
||||||
context->Makefile->FindTargetToUse(targetName.c_str()))
|
|
||||||
{
|
{
|
||||||
return tgt->GetName();
|
return tgt->GetName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
target = context->Makefile->FindTargetToUse(
|
target = context->Makefile->FindTargetToUse(targetName);
|
||||||
targetName.c_str());
|
|
||||||
|
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
|
@ -1476,7 +1474,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
|
||||||
"Expression syntax not recognized.");
|
"Expression syntax not recognized.");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
cmTarget* target = context->Makefile->FindTargetToUse(name.c_str());
|
cmTarget* target = context->Makefile->FindTargetToUse(name);
|
||||||
if(!target)
|
if(!target)
|
||||||
{
|
{
|
||||||
::reportError(context, content->GetOriginalExpression(),
|
::reportError(context, content->GetOriginalExpression(),
|
||||||
|
|
|
@ -68,7 +68,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, const std::string &name,
|
||||||
std::vector<std::string>& result,
|
std::vector<std::string>& result,
|
||||||
bool excludeImported)
|
bool excludeImported)
|
||||||
{
|
{
|
||||||
cmTarget* depTgt = mf->FindTargetToUse(name.c_str());
|
cmTarget* depTgt = mf->FindTargetToUse(name);
|
||||||
|
|
||||||
if (!depTgt)
|
if (!depTgt)
|
||||||
{
|
{
|
||||||
|
@ -230,7 +230,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
|
||||||
{
|
{
|
||||||
if (uniqueDeps.insert(*li).second)
|
if (uniqueDeps.insert(*li).second)
|
||||||
{
|
{
|
||||||
cmTarget* tgt = this->Makefile->FindTargetToUse(li->c_str());
|
cmTarget* tgt = this->Makefile->FindTargetToUse(*li);
|
||||||
|
|
||||||
if (!tgt)
|
if (!tgt)
|
||||||
{
|
{
|
||||||
|
@ -394,7 +394,7 @@ void cmGeneratorTarget::LookupObjectLibraries()
|
||||||
oli != objLibs.end(); ++oli)
|
oli != objLibs.end(); ++oli)
|
||||||
{
|
{
|
||||||
std::string const& objLibName = *oli;
|
std::string const& objLibName = *oli;
|
||||||
if(cmTarget* objLib = this->Makefile->FindTargetToUse(objLibName.c_str()))
|
if(cmTarget* objLib = this->Makefile->FindTargetToUse(objLibName))
|
||||||
{
|
{
|
||||||
if(objLib->GetType() == cmTarget::OBJECT_LIBRARY)
|
if(objLib->GetType() == cmTarget::OBJECT_LIBRARY)
|
||||||
{
|
{
|
||||||
|
@ -607,7 +607,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a target with this name.
|
// Check for a target with this name.
|
||||||
if(cmTarget* t = this->Makefile->FindTargetToUse(util.c_str()))
|
if(cmTarget* t = this->Makefile->FindTargetToUse(util))
|
||||||
{
|
{
|
||||||
// If we find the target and the dep was given as a full path,
|
// If we find the target and the dep was given as a full path,
|
||||||
// then make sure it was not a full path to something else, and
|
// then make sure it was not a full path to something else, and
|
||||||
|
@ -661,7 +661,7 @@ cmTargetTraceDependencies
|
||||||
{
|
{
|
||||||
std::string const& command = *cit->begin();
|
std::string const& command = *cit->begin();
|
||||||
// Check for a target with this name.
|
// Check for a target with this name.
|
||||||
if(cmTarget* t = this->Makefile->FindTargetToUse(command.c_str()))
|
if(cmTarget* t = this->Makefile->FindTargetToUse(command))
|
||||||
{
|
{
|
||||||
if(t->GetType() == cmTarget::EXECUTABLE)
|
if(t->GetType() == cmTarget::EXECUTABLE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -290,17 +290,17 @@ bool cmGetPropertyCommand::HandleTargetMode()
|
||||||
|
|
||||||
if(this->PropertyName == "ALIASED_TARGET")
|
if(this->PropertyName == "ALIASED_TARGET")
|
||||||
{
|
{
|
||||||
if(this->Makefile->IsAlias(this->Name.c_str()))
|
if(this->Makefile->IsAlias(this->Name))
|
||||||
{
|
{
|
||||||
if(cmTarget* target =
|
if(cmTarget* target =
|
||||||
this->Makefile->FindTargetToUse(this->Name.c_str()))
|
this->Makefile->FindTargetToUse(this->Name))
|
||||||
{
|
{
|
||||||
return this->StoreResult(target->GetName());
|
return this->StoreResult(target->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this->StoreResult((this->Variable + "-NOTFOUND").c_str());
|
return this->StoreResult((this->Variable + "-NOTFOUND").c_str());
|
||||||
}
|
}
|
||||||
if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name.c_str()))
|
if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name))
|
||||||
{
|
{
|
||||||
return this->StoreResult(target->GetProperty(this->PropertyName.c_str()));
|
return this->StoreResult(target->GetProperty(this->PropertyName.c_str()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ bool cmGetTargetPropertyCommand
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::string var = args[0].c_str();
|
std::string var = args[0].c_str();
|
||||||
const char* targetName = args[1].c_str();
|
const std::string& targetName = args[1];
|
||||||
const char *prop = 0;
|
const char *prop = 0;
|
||||||
|
|
||||||
if(args[2] == "ALIASED_TARGET")
|
if(args[2] == "ALIASED_TARGET")
|
||||||
|
|
|
@ -543,7 +543,7 @@ namespace
|
||||||
if (*arg == "TARGET" && argP1 != newArgs.end())
|
if (*arg == "TARGET" && argP1 != newArgs.end())
|
||||||
{
|
{
|
||||||
HandlePredicate(
|
HandlePredicate(
|
||||||
makefile->FindTargetToUse((argP1)->c_str())? true:false,
|
makefile->FindTargetToUse(*argP1)?true:false,
|
||||||
reducible, arg, newArgs, argP1, argP2);
|
reducible, arg, newArgs, argP1, argP2);
|
||||||
}
|
}
|
||||||
// is a variable defined
|
// is a variable defined
|
||||||
|
|
|
@ -363,7 +363,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
||||||
++targetIt)
|
++targetIt)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (this->Makefile->IsAlias(targetIt->c_str()))
|
if (this->Makefile->IsAlias(*targetIt))
|
||||||
{
|
{
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "TARGETS given target \"" << (*targetIt)
|
e << "TARGETS given target \"" << (*targetIt)
|
||||||
|
@ -372,7 +372,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Lookup this target in the current directory.
|
// Lookup this target in the current directory.
|
||||||
if(cmTarget* target=this->Makefile->FindTarget(targetIt->c_str()))
|
if(cmTarget* target=this->Makefile->FindTarget(*targetIt))
|
||||||
{
|
{
|
||||||
// Found the target. Check its type.
|
// Found the target. Check its type.
|
||||||
if(target->GetType() != cmTarget::EXECUTABLE &&
|
if(target->GetType() != cmTarget::EXECUTABLE &&
|
||||||
|
|
|
@ -2021,7 +2021,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for a CMake target with the given name.
|
// Look for a CMake target with the given name.
|
||||||
if(cmTarget* target = this->Makefile->FindTargetToUse(name.c_str()))
|
if(cmTarget* target = this->Makefile->FindTargetToUse(name))
|
||||||
{
|
{
|
||||||
// make sure it is not just a coincidence that the target name
|
// make sure it is not just a coincidence that the target name
|
||||||
// found is part of the inName
|
// found is part of the inName
|
||||||
|
|
|
@ -3859,7 +3859,8 @@ const char* cmMakefile::GetFeature(const char* feature, const char* config)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTarget* cmMakefile::FindTarget(const char* name, bool excludeAliases) const
|
cmTarget* cmMakefile::FindTarget(const std::string& name,
|
||||||
|
bool excludeAliases) const
|
||||||
{
|
{
|
||||||
if (!excludeAliases)
|
if (!excludeAliases)
|
||||||
{
|
{
|
||||||
|
@ -4063,7 +4064,8 @@ cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTarget* cmMakefile::FindTargetToUse(const char* name, bool excludeAliases)
|
cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
|
||||||
|
bool excludeAliases)
|
||||||
{
|
{
|
||||||
// Look for an imported target. These take priority because they
|
// Look for an imported target. These take priority because they
|
||||||
// are more local in scope and do not have to be globally unique.
|
// are more local in scope and do not have to be globally unique.
|
||||||
|
@ -4081,16 +4083,18 @@ cmTarget* cmMakefile::FindTargetToUse(const char* name, bool excludeAliases)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for a target built in this project.
|
// Look for a target built in this project.
|
||||||
return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name,
|
return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0,
|
||||||
|
name.c_str(),
|
||||||
excludeAliases);
|
excludeAliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmMakefile::IsAlias(const char *name)
|
bool cmMakefile::IsAlias(const std::string& name)
|
||||||
{
|
{
|
||||||
if (this->AliasTargets.find(name) != this->AliasTargets.end())
|
if (this->AliasTargets.find(name) != this->AliasTargets.end())
|
||||||
return true;
|
return true;
|
||||||
return this->GetLocalGenerator()->GetGlobalGenerator()->IsAlias(name);
|
return this->GetLocalGenerator()->GetGlobalGenerator()->IsAlias(
|
||||||
|
name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -4107,7 +4111,7 @@ cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name)
|
||||||
bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
|
bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
|
||||||
bool isCustom)
|
bool isCustom)
|
||||||
{
|
{
|
||||||
if(this->IsAlias(name.c_str()))
|
if(this->IsAlias(name))
|
||||||
{
|
{
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "cannot create target \"" << name
|
e << "cannot create target \"" << name
|
||||||
|
@ -4115,7 +4119,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
|
||||||
msg = e.str();
|
msg = e.str();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(cmTarget* existing = this->FindTargetToUse(name.c_str()))
|
if(cmTarget* existing = this->FindTargetToUse(name))
|
||||||
{
|
{
|
||||||
// The name given conflicts with an existing target. Produce an
|
// The name given conflicts with an existing target. Produce an
|
||||||
// error in a compatible way.
|
// error in a compatible way.
|
||||||
|
|
|
@ -533,12 +533,14 @@ public:
|
||||||
this->GeneratorTargets = targets;
|
this->GeneratorTargets = targets;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTarget* FindTarget(const char* name, bool excludeAliases = false) const;
|
cmTarget* FindTarget(const std::string& name,
|
||||||
|
bool excludeAliases = false) const;
|
||||||
|
|
||||||
/** Find a target to use in place of the given name. The target
|
/** Find a target to use in place of the given name. The target
|
||||||
returned may be imported or built within the project. */
|
returned may be imported or built within the project. */
|
||||||
cmTarget* FindTargetToUse(const char* name, bool excludeAliases = false);
|
cmTarget* FindTargetToUse(const std::string& name,
|
||||||
bool IsAlias(const char *name);
|
bool excludeAliases = false);
|
||||||
|
bool IsAlias(const std::string& name);
|
||||||
cmGeneratorTarget* FindGeneratorTargetToUse(const char* name);
|
cmGeneratorTarget* FindGeneratorTargetToUse(const char* name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -244,12 +244,12 @@ bool cmSetPropertyCommand::HandleTargetMode()
|
||||||
for(std::set<cmStdString>::const_iterator ni = this->Names.begin();
|
for(std::set<cmStdString>::const_iterator ni = this->Names.begin();
|
||||||
ni != this->Names.end(); ++ni)
|
ni != this->Names.end(); ++ni)
|
||||||
{
|
{
|
||||||
if (this->Makefile->IsAlias(ni->c_str()))
|
if (this->Makefile->IsAlias(*ni))
|
||||||
{
|
{
|
||||||
this->SetError("can not be used on an ALIAS target.");
|
this->SetError("can not be used on an ALIAS target.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(cmTarget* target = this->Makefile->FindTargetToUse(ni->c_str()))
|
if(cmTarget* target = this->Makefile->FindTargetToUse(*ni))
|
||||||
{
|
{
|
||||||
// Handle the current target.
|
// Handle the current target.
|
||||||
if(!this->HandleTarget(target))
|
if(!this->HandleTarget(target))
|
||||||
|
|
|
@ -72,7 +72,7 @@ bool cmSetTargetPropertiesCommand
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < numFiles; ++i)
|
for(i = 0; i < numFiles; ++i)
|
||||||
{
|
{
|
||||||
if (this->Makefile->IsAlias(args[i].c_str()))
|
if (this->Makefile->IsAlias(args[i]))
|
||||||
{
|
{
|
||||||
this->SetError("can not be used on an ALIAS target.");
|
this->SetError("can not be used on an ALIAS target.");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1681,14 +1681,14 @@ static void processIncludeDirectories(cmTarget const* tgt,
|
||||||
evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0);
|
evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTarget *dependentTarget = mf->FindTargetToUse(targetName.c_str());
|
cmTarget *dependentTarget = mf->FindTargetToUse(targetName);
|
||||||
|
|
||||||
const bool fromImported = dependentTarget
|
const bool fromImported = dependentTarget
|
||||||
&& dependentTarget->IsImported();
|
&& dependentTarget->IsImported();
|
||||||
|
|
||||||
cmTarget *evaluatedDependentTarget =
|
cmTarget *evaluatedDependentTarget =
|
||||||
(targetName != evaluatedTargetName)
|
(targetName != evaluatedTargetName)
|
||||||
? mf->FindTargetToUse(evaluatedTargetName.c_str())
|
? mf->FindTargetToUse(evaluatedTargetName)
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
targetName = evaluatedTargetName;
|
targetName = evaluatedTargetName;
|
||||||
|
@ -1860,7 +1860,7 @@ cmTarget::GetIncludeDirectories(const char *config) const
|
||||||
ge.Parse(it->Value);
|
ge.Parse(it->Value);
|
||||||
std::string result = cge->Evaluate(this->Makefile, config,
|
std::string result = cge->Evaluate(this->Makefile, config,
|
||||||
false, this, 0, 0);
|
false, this, 0, 0);
|
||||||
if (!this->Makefile->FindTargetToUse(result.c_str()))
|
if (!this->Makefile->FindTargetToUse(result))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2089,7 +2089,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
|
||||||
ge.Parse(it->Value);
|
ge.Parse(it->Value);
|
||||||
std::string targetResult = cge->Evaluate(this->Makefile, config,
|
std::string targetResult = cge->Evaluate(this->Makefile, config,
|
||||||
false, this, 0, 0);
|
false, this, 0, 0);
|
||||||
if (!this->Makefile->FindTargetToUse(targetResult.c_str()))
|
if (!this->Makefile->FindTargetToUse(targetResult))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2202,7 +2202,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
|
||||||
ge.Parse(it->Value);
|
ge.Parse(it->Value);
|
||||||
std::string targetResult = cge->Evaluate(this->Makefile, config,
|
std::string targetResult = cge->Evaluate(this->Makefile, config,
|
||||||
false, this, 0, 0);
|
false, this, 0, 0);
|
||||||
if (!this->Makefile->FindTargetToUse(targetResult.c_str()))
|
if (!this->Makefile->FindTargetToUse(targetResult))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2861,7 +2861,7 @@ public:
|
||||||
for(std::vector<std::string>::const_iterator
|
for(std::vector<std::string>::const_iterator
|
||||||
li = iface->Libraries.begin(); li != iface->Libraries.end(); ++li)
|
li = iface->Libraries.begin(); li != iface->Libraries.end(); ++li)
|
||||||
{
|
{
|
||||||
this->Visit(mf->FindTargetToUse(li->c_str()));
|
this->Visit(mf->FindTargetToUse(*li));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
@ -2969,7 +2969,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
|
||||||
for(std::vector<std::string>::const_iterator li = impl->Libraries.begin();
|
for(std::vector<std::string>::const_iterator li = impl->Libraries.begin();
|
||||||
li != impl->Libraries.end(); ++li)
|
li != impl->Libraries.end(); ++li)
|
||||||
{
|
{
|
||||||
cll.Visit(this->Makefile->FindTargetToUse(li->c_str()));
|
cll.Visit(this->Makefile->FindTargetToUse(*li));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the transitive closure of languages.
|
// Store the transitive closure of languages.
|
||||||
|
@ -5414,7 +5414,7 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
|
||||||
{
|
{
|
||||||
if(emitted.insert(*li).second)
|
if(emitted.insert(*li).second)
|
||||||
{
|
{
|
||||||
if(cmTarget* tgt = this->Makefile->FindTargetToUse(li->c_str()))
|
if(cmTarget* tgt = this->Makefile->FindTargetToUse(*li))
|
||||||
{
|
{
|
||||||
// This is a runtime dependency on another shared library.
|
// This is a runtime dependency on another shared library.
|
||||||
if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
|
if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
|
||||||
|
@ -5624,7 +5624,7 @@ void cmTarget::ComputeLinkImplementation(const char* config,
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cmTarget *tgt = this->Makefile->FindTargetToUse(li->c_str());
|
cmTarget *tgt = this->Makefile->FindTargetToUse(*li);
|
||||||
|
|
||||||
if(!tgt && std::string(item).find("::") != std::string::npos)
|
if(!tgt && std::string(item).find("::") != std::string::npos)
|
||||||
{
|
{
|
||||||
|
@ -5695,7 +5695,7 @@ void cmTarget::ComputeLinkImplementation(const char* config,
|
||||||
i = this->ObjectLibraries.begin();
|
i = this->ObjectLibraries.begin();
|
||||||
i != this->ObjectLibraries.end(); ++i)
|
i != this->ObjectLibraries.end(); ++i)
|
||||||
{
|
{
|
||||||
if(cmTarget* objLib = this->Makefile->FindTargetToUse(i->c_str()))
|
if(cmTarget* objLib = this->Makefile->FindTargetToUse(*i))
|
||||||
{
|
{
|
||||||
if(objLib->GetType() == cmTarget::OBJECT_LIBRARY)
|
if(objLib->GetType() == cmTarget::OBJECT_LIBRARY)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@ bool cmTargetLinkLibrariesCommand
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->Makefile->IsAlias(args[0].c_str()))
|
if (this->Makefile->IsAlias(args[0]))
|
||||||
{
|
{
|
||||||
this->SetError("can not be used on an ALIAS target.");
|
this->SetError("can not be used on an ALIAS target.");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -26,7 +26,7 @@ bool cmTargetPropCommandBase
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup the target for which libraries are specified.
|
// Lookup the target for which libraries are specified.
|
||||||
if (this->Makefile->IsAlias(args[0].c_str()))
|
if (this->Makefile->IsAlias(args[0]))
|
||||||
{
|
{
|
||||||
this->SetError("can not be used on an ALIAS target.");
|
this->SetError("can not be used on an ALIAS target.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -36,7 +36,7 @@ bool cmTargetPropCommandBase
|
||||||
->GetGlobalGenerator()->FindTarget(0, args[0].c_str());
|
->GetGlobalGenerator()->FindTarget(0, args[0].c_str());
|
||||||
if(!this->Target)
|
if(!this->Target)
|
||||||
{
|
{
|
||||||
this->Target = this->Makefile->FindTargetToUse(args[0].c_str());
|
this->Target = this->Makefile->FindTargetToUse(args[0]);
|
||||||
}
|
}
|
||||||
if(!this->Target)
|
if(!this->Target)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,7 +82,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
||||||
// be translated.
|
// be translated.
|
||||||
std::string exe = command[0];
|
std::string exe = command[0];
|
||||||
cmMakefile* mf = this->Test->GetMakefile();
|
cmMakefile* mf = this->Test->GetMakefile();
|
||||||
cmTarget* target = mf->FindTargetToUse(exe.c_str());
|
cmTarget* target = mf->FindTargetToUse(exe);
|
||||||
if(target && target->GetType() == cmTarget::EXECUTABLE)
|
if(target && target->GetType() == cmTarget::EXECUTABLE)
|
||||||
{
|
{
|
||||||
// Use the target file on disk.
|
// Use the target file on disk.
|
||||||
|
|
Loading…
Reference in New Issue