Commit 0779bc93 authored by Vitaly Stakhovsky's avatar Vitaly Stakhovsky Committed by Brad King
Browse files

ReadListFile: Accept std::string argument

parent 8ea30a44
......@@ -693,7 +693,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
std::string var = this->Name;
var += "_FIND_MODULE";
this->Makefile->AddDefinition(var, "1");
bool result = this->ReadListFile(mfile.c_str(), DoPolicyScope);
bool result = this->ReadListFile(mfile, DoPolicyScope);
this->Makefile->RemoveDefinition(var);
return result;
}
......@@ -776,7 +776,7 @@ bool cmFindPackageCommand::HandlePackageMode()
this->StoreVersionFound();
// Parse the configuration file.
if (this->ReadListFile(this->FileFound.c_str(), DoPolicyScope)) {
if (this->ReadListFile(this->FileFound, DoPolicyScope)) {
// The package has been found.
found = true;
......@@ -1036,7 +1036,8 @@ bool cmFindPackageCommand::FindAppBundleConfig()
return false;
}
bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
bool cmFindPackageCommand::ReadListFile(const std::string& f,
PolicyScopeRule psr)
{
const bool noPolicyScope = !this->PolicyScope || psr == NoPolicyScope;
if (this->Makefile->ReadDependentFile(f, noPolicyScope)) {
......@@ -1590,7 +1591,7 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file,
// Load the version check file. Pass NoPolicyScope because we do
// our own policy push/pop independent of CMP0011.
bool suitable = false;
if (this->ReadListFile(version_file.c_str(), NoPolicyScope)) {
if (this->ReadListFile(version_file, NoPolicyScope)) {
// Check the output variables.
bool okay = this->Makefile->IsOn("PACKAGE_VERSION_EXACT");
bool unsuitable = this->Makefile->IsOn("PACKAGE_VERSION_UNSUITABLE");
......
......@@ -110,7 +110,7 @@ private:
NoPolicyScope,
DoPolicyScope
};
bool ReadListFile(const char* f, PolicyScopeRule psr);
bool ReadListFile(const std::string& f, PolicyScopeRule psr);
void StoreVersionFound();
void ComputePrefixes();
......
......@@ -437,7 +437,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
}
std::cout << "loading initial cache file " << path << "\n";
this->ReadListFile(args, path.c_str());
this->ReadListFile(args, path);
} else if (arg.find("-P", 0) == 0) {
i++;
if (i >= args.size()) {
......@@ -451,7 +451,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
// Register fake project commands that hint misuse in script mode.
GetProjectCommandsInScriptMode(this->State);
this->ReadListFile(args, path.c_str());
this->ReadListFile(args, path);
} else if (arg.find("--find-package", 0) == 0) {
findPackageMode = true;
}
......@@ -465,7 +465,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
void cmake::ReadListFile(const std::vector<std::string>& args,
const char* path)
const std::string& path)
{
// if a generator was not yet created, temporarily create one
cmGlobalGenerator* gg = this->GetGlobalGenerator();
......@@ -478,7 +478,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
}
// read in the list file to fill the cache
if (path) {
if (!path.empty()) {
this->CurrentSnapshot = this->State->Reset();
std::string homeDir = this->GetHomeDirectory();
std::string homeOutputDir = this->GetHomeOutputDirectory();
......@@ -499,7 +499,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
mf.SetArgcArgv(args);
}
if (!mf.ReadListFile(path)) {
cmSystemTools::Error("Error processing file: ", path);
cmSystemTools::Error("Error processing file: " + path);
}
this->SetHomeDirectory(homeDir);
this->SetHomeOutputDirectory(homeOutputDir);
......@@ -1606,14 +1606,14 @@ void cmake::PreLoadCMakeFiles()
if (!pre_load.empty()) {
pre_load += "/PreLoad.cmake";
if (cmSystemTools::FileExists(pre_load)) {
this->ReadListFile(args, pre_load.c_str());
this->ReadListFile(args, pre_load);
}
}
pre_load = this->GetHomeOutputDirectory();
if (!pre_load.empty()) {
pre_load += "/PreLoad.cmake";
if (cmSystemTools::FileExists(pre_load)) {
this->ReadListFile(args, pre_load.c_str());
this->ReadListFile(args, pre_load);
}
}
}
......@@ -2613,7 +2613,7 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target,
cachePath + "/" + "CMakeFiles/" + "VerifyGlobs.cmake";
if (cmSystemTools::FileExists(globVerifyScript)) {
std::vector<std::string> args;
this->ReadListFile(args, globVerifyScript.c_str());
this->ReadListFile(args, globVerifyScript);
}
}
......
......@@ -463,7 +463,8 @@ protected:
std::string GeneratorToolset;
///! read in a cmake list file to initialize the cache
void ReadListFile(const std::vector<std::string>& args, const char* path);
void ReadListFile(const std::vector<std::string>& args,
const std::string& path);
bool FindPackage(const std::vector<std::string>& args);
///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment