summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorRolf Eike Beer <kde@opensource.sf-tec.de>2014-01-15 22:56:38 (GMT)
committerBrad King <brad.king@kitware.com>2014-01-16 14:28:29 (GMT)
commitc768e398f9c29aa12680fe89a52ce9b00eff2866 (patch)
treed60f39ce1c2b37557ec83d9e91c64ff9147f94fe /Source/cmMakefile.cxx
parent4c7bac45ae1347ebea6709a7fdf59f50ff7bbb15 (diff)
downloadCMake-c768e398f9c29aa12680fe89a52ce9b00eff2866.zip
CMake-c768e398f9c29aa12680fe89a52ce9b00eff2866.tar.gz
CMake-c768e398f9c29aa12680fe89a52ce9b00eff2866.tar.bz2
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.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 479e712..222cdb6 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3859,7 +3859,8 @@ const char* cmMakefile::GetFeature(const char* feature, const char* config)
return 0;
}
-cmTarget* cmMakefile::FindTarget(const char* name, bool excludeAliases) const
+cmTarget* cmMakefile::FindTarget(const std::string& name,
+ bool excludeAliases) const
{
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
// 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.
- return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name,
+ return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0,
+ name.c_str(),
excludeAliases);
}
//----------------------------------------------------------------------------
-bool cmMakefile::IsAlias(const char *name)
+bool cmMakefile::IsAlias(const std::string& name)
{
if (this->AliasTargets.find(name) != this->AliasTargets.end())
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 isCustom)
{
- if(this->IsAlias(name.c_str()))
+ if(this->IsAlias(name))
{
cmOStringStream e;
e << "cannot create target \"" << name
@@ -4115,7 +4119,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
msg = e.str();
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
// error in a compatible way.