diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-02-06 19:05:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-08 18:05:29 (GMT) |
commit | 310ef08fed57b1c60ea8dc8ed98520e2cb0bff4e (patch) | |
tree | 89b17e537dd73551de0c5c225b18a6bfbee2ed8b /Source/cmMakefile.cxx | |
parent | 24e8b929eef74098d4ddf4581619322e0f4b5108 (diff) | |
download | CMake-310ef08fed57b1c60ea8dc8ed98520e2cb0bff4e.zip CMake-310ef08fed57b1c60ea8dc8ed98520e2cb0bff4e.tar.gz CMake-310ef08fed57b1c60ea8dc8ed98520e2cb0bff4e.tar.bz2 |
stringapi: Use strings for source names
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 76b3b09..97628f3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2060,9 +2060,8 @@ cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name) } cmSourceFile* -cmMakefile::LinearGetSourceFileWithOutput(const char *cname) const +cmMakefile::LinearGetSourceFileWithOutput(const std::string& name) const { - std::string name = cname; std::string out; // look through all the source files that have custom commands @@ -2096,15 +2095,14 @@ cmMakefile::LinearGetSourceFileWithOutput(const char *cname) const return 0; } -cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname) const +cmSourceFile *cmMakefile::GetSourceFileWithOutput( + const std::string& name) const { - std::string name = cname; - // If the queried path is not absolute we use the backward compatible // linear-time search for an output with a matching suffix. - if(!cmSystemTools::FileIsFullPath(cname)) + if(!cmSystemTools::FileIsFullPath(name.c_str())) { - return LinearGetSourceFileWithOutput(cname); + return LinearGetSourceFileWithOutput(name.c_str()); } // Otherwise we use an efficient lookup map. OutputToSourceMap::const_iterator o = this->OutputToSource.find(name); @@ -2149,15 +2147,12 @@ cmMakefile::GetSourceGroup(const std::vector<std::string>&name) const return sg; } - void cmMakefile::AddSourceGroup(const char* name, +void cmMakefile::AddSourceGroup(const std::string& name, const char* regex) { - if (name) - { - std::vector<std::string> nameVector; - nameVector.push_back(name); - AddSourceGroup(nameVector, regex); - } + std::vector<std::string> nameVector; + nameVector.push_back(name); + AddSourceGroup(nameVector, regex); } void cmMakefile::AddSourceGroup(const std::vector<std::string>& name, @@ -3011,9 +3006,9 @@ void cmMakefile::SetArgcArgv(const std::vector<std::string>& args) } //---------------------------------------------------------------------------- -cmSourceFile* cmMakefile::GetSource(const char* sourceName) const +cmSourceFile* cmMakefile::GetSource(const std::string& sourceName) const { - cmSourceFileLocation sfl(this, sourceName); + cmSourceFileLocation sfl(this, sourceName.c_str()); for(std::vector<cmSourceFile*>::const_iterator sfi = this->SourceFiles.begin(); sfi != this->SourceFiles.end(); ++sfi) @@ -3028,7 +3023,7 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const } //---------------------------------------------------------------------------- -cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName, +cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName, bool generated) { if(cmSourceFile* esf = this->GetSource(sourceName)) @@ -3037,7 +3032,7 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName, } else { - cmSourceFile* sf = new cmSourceFile(this, sourceName); + cmSourceFile* sf = new cmSourceFile(this, sourceName.c_str()); if(generated) { sf->SetProperty("GENERATED", "1"); |