summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmFindPackageCommand.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx31
-rw-r--r--Source/cmIncludeCommand.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx4
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmMakefile.h4
6 files changed, 20 insertions, 25 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 9ae1cb9..97ef481 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -663,7 +663,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
module += this->Name;
module += ".cmake";
bool system = false;
- std::string mfile = this->Makefile->GetModulesFile(module.c_str(), system);
+ std::string mfile = this->Makefile->GetModulesFile(module, system);
if (!mfile.empty()) {
if (system) {
auto it = this->DeprecatedFindModules.find(this->Name);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2d36315..b2b0e38 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -353,8 +353,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
}
if (!mf->GetDefinition("CMAKE_MAKE_PROGRAM") ||
cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
- std::string setMakeProgram =
- mf->GetModulesFile(this->FindMakeProgramFile.c_str());
+ std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile);
if (!setMakeProgram.empty()) {
mf->ReadListFile(setMakeProgram);
}
@@ -464,11 +463,10 @@ void cmGlobalGenerator::EnableLanguage(
if (this->TryCompileOuterMakefile) {
// In a try-compile we can only enable languages provided by caller.
- for (std::string const& li : languages) {
- if (li == "NONE") {
+ for (std::string const& lang : languages) {
+ if (lang == "NONE") {
this->SetLanguageEnabled("NONE", mf);
} else {
- const char* lang = li.c_str();
if (this->LanguagesReady.find(lang) == this->LanguagesReady.end()) {
std::ostringstream e;
e << "The test project needs language " << lang
@@ -616,10 +614,9 @@ void cmGlobalGenerator::EnableLanguage(
// load the CMakeDetermine(LANG)Compiler.cmake file to find
// the compiler
- for (std::string const& l : languages) {
- const char* lang = l.c_str();
+ for (std::string const& lang : languages) {
needSetLanguageEnabledMaps[lang] = false;
- if (l == "NONE") {
+ if (lang == "NONE") {
this->SetLanguageEnabled("NONE", mf);
continue;
}
@@ -661,8 +658,7 @@ void cmGlobalGenerator::EnableLanguage(
std::string determineCompiler = "CMakeDetermine";
determineCompiler += lang;
determineCompiler += "Compiler.cmake";
- std::string determineFile =
- mf->GetModulesFile(determineCompiler.c_str());
+ std::string determineFile = mf->GetModulesFile(determineCompiler);
if (!mf->ReadListFile(determineFile)) {
cmSystemTools::Error("Could not find cmake module file: ",
determineCompiler.c_str());
@@ -721,9 +717,8 @@ void cmGlobalGenerator::EnableLanguage(
}
// loop over languages again loading CMake(LANG)Information.cmake
//
- for (std::string const& l : languages) {
- const char* lang = l.c_str();
- if (l == "NONE") {
+ for (std::string const& lang : languages) {
+ if (lang == "NONE") {
this->SetLanguageEnabled("NONE", mf);
continue;
}
@@ -744,7 +739,7 @@ void cmGlobalGenerator::EnableLanguage(
"No " << compilerName << " could be found.\n"
;
/* clang-format on */
- } else if (strcmp(lang, "RC") != 0 && strcmp(lang, "ASM_MASM") != 0) {
+ } else if ((lang != "RC") && (lang != "ASM_MASM")) {
if (!cmSystemTools::FileIsFullPath(compilerFile)) {
/* clang-format off */
noCompiler <<
@@ -790,7 +785,7 @@ void cmGlobalGenerator::EnableLanguage(
fpath = "CMake";
fpath += lang;
fpath += "Information.cmake";
- std::string informationFile = mf->GetModulesFile(fpath.c_str());
+ std::string informationFile = mf->GetModulesFile(fpath);
if (informationFile.empty()) {
cmSystemTools::Error("Could not find cmake module file: ",
fpath.c_str());
@@ -814,7 +809,7 @@ void cmGlobalGenerator::EnableLanguage(
std::string testLang = "CMakeTest";
testLang += lang;
testLang += "Compiler.cmake";
- std::string ifpath = mf->GetModulesFile(testLang.c_str());
+ std::string ifpath = mf->GetModulesFile(testLang);
if (!mf->ReadListFile(ifpath)) {
cmSystemTools::Error("Could not find cmake module file: ",
testLang.c_str());
@@ -2861,7 +2856,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
if (strncmp(line.c_str(), rhi->second.Data, 32) != 0) {
// The rule has changed. Delete the output so it will be
// built again.
- fname = cmSystemTools::CollapseFullPath(fname, home.c_str());
+ fname = cmSystemTools::CollapseFullPath(fname, home);
cmSystemTools::RemoveFile(fname);
}
} else {
@@ -2871,7 +2866,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
// Instead, we keep the rule hash as long as the file exists so
// that if the feature is turned back on and the rule has
// changed the file is still rebuilt.
- std::string fpath = cmSystemTools::CollapseFullPath(fname, home.c_str());
+ std::string fpath = cmSystemTools::CollapseFullPath(fname, home);
if (cmSystemTools::FileExists(fpath)) {
RuleHash hash;
memcpy(hash.Data, line.c_str(), 32);
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index a67d09e..0d608bb 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -67,7 +67,7 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
// Not a path. Maybe module.
std::string module = fname;
module += ".cmake";
- std::string mfile = this->Makefile->GetModulesFile(module.c_str());
+ std::string mfile = this->Makefile->GetModulesFile(module);
if (!mfile.empty()) {
fname = mfile;
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 23afbd0..3771737 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2791,7 +2791,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
const char* in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST");
std::string inFile = (in && *in) ? in : "MacOSXBundleInfo.plist.in";
if (!cmSystemTools::FileIsFullPath(inFile)) {
- std::string inMod = this->Makefile->GetModulesFile(inFile.c_str());
+ std::string inMod = this->Makefile->GetModulesFile(inFile);
if (!inMod.empty()) {
inFile = inMod;
}
@@ -2829,7 +2829,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(
const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST");
std::string inFile = (in && *in) ? in : "MacOSXFrameworkInfo.plist.in";
if (!cmSystemTools::FileIsFullPath(inFile)) {
- std::string inMod = this->Makefile->GetModulesFile(inFile.c_str());
+ std::string inMod = this->Makefile->GetModulesFile(inFile);
if (!inMod.empty()) {
inFile = inMod;
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9589b7f..500776e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3516,7 +3516,7 @@ void cmMakefile::DisplayStatus(const char* message, float s) const
cm->UpdateProgress(message, s);
}
-std::string cmMakefile::GetModulesFile(const char* filename,
+std::string cmMakefile::GetModulesFile(const std::string& filename,
bool& system) const
{
std::string result;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index abe2cd1..e88bb0b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -689,13 +689,13 @@ public:
/**
* Return a location of a file in cmake or custom modules directory
*/
- std::string GetModulesFile(const char* name) const
+ std::string GetModulesFile(const std::string& name) const
{
bool system;
return this->GetModulesFile(name, system);
}
- std::string GetModulesFile(const char* name, bool& system) const;
+ std::string GetModulesFile(const std::string& name, bool& system) const;
///! Set/Get a property of this directory
void SetProperty(const std::string& prop, const char* value);