mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 11:49:55 -06:00
cmMakefile: GetModulesFile() accepts std::string param
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -2783,7 +2783,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;
|
||||
}
|
||||
@@ -2821,7 +2821,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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user