Commit 3404f8a0 authored by Stephen Kelly's avatar Stephen Kelly
Browse files

cmMakefile: Move ListFile parsing responsibility out of internal method.

parent a1858136
......@@ -533,38 +533,51 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename)
{
this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename);
std::string curSrc = this->GetCurrentSourceDirectory();
std::string filenametoread =
cmSystemTools::CollapseFullPath(filename,
this->GetCurrentSourceDirectory());
this->ListFileStack.push_back(filenametoread);
cmListFile listFile;
if (!listFile.ParseFile(filenametoread.c_str(),
curSrc == this->GetHomeDirectory(), this))
{
return false;
}
this->PushPolicyBarrier();
bool result = this->ReadListFile(filename,
curSrc == this->GetHomeDirectory());
this->ReadListFile(listFile, filenametoread);
this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured());
this->EnforceDirectoryLevelRules();
return result;
return true;
}
bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
{
this->AddDefinition("CMAKE_PARENT_LIST_FILE",
this->GetDefinition("CMAKE_CURRENT_LIST_FILE"));
std::string filenametoread =
cmSystemTools::CollapseFullPath(filename,
this->GetCurrentSourceDirectory());
this->ListFileStack.push_back(filenametoread);
cmListFile listFile;
if (!listFile.ParseFile(filenametoread.c_str(), false, this))
{
return false;
}
IncludeScope incScope(this, noPolicyScope);
bool result = this->ReadListFile(filename, false);
this->ReadListFile(listFile, filenametoread);
if(cmSystemTools::GetFatalErrorOccured())
{
incScope.Quiet();
}
return result;
return true;
}
bool cmMakefile::ReadListFile(const char* filename)
{
this->PushPolicyBarrier();
bool result = this->ReadListFile(filename, false);
this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured());
this->ListFileStack.pop_back();
return result;
}
bool cmMakefile::ReadListFile(const char* filename,
bool requireProjectCommand)
{
std::string filenametoread =
cmSystemTools::CollapseFullPath(filename,
......@@ -573,12 +586,21 @@ bool cmMakefile::ReadListFile(const char* filename,
this->ListFileStack.push_back(filenametoread);
cmListFile listFile;
if (!listFile.ParseFile(filenametoread.c_str(),
requireProjectCommand, this))
if (!listFile.ParseFile(filenametoread.c_str(), false, this))
{
return false;
}
this->PushPolicyBarrier();
this->ReadListFile(listFile, filenametoread);
this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured());
this->ListFileStack.pop_back();
return true;
}
void cmMakefile::ReadListFile(cmListFile const& listFile,
std::string const& filenametoread)
{
// add this list file to the list of dependencies
this->ListFiles.push_back(filenametoread);
......@@ -625,8 +647,6 @@ bool cmMakefile::ReadListFile(const char* filename,
this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
return true;
}
//----------------------------------------------------------------------------
......
......@@ -914,8 +914,8 @@ private:
cmState::Snapshot StateSnapshot;
bool ReadListFile(const char* filename,
bool requireProjectCommand);
void ReadListFile(cmListFile const& listFile,
const std::string& filenametoread);
bool ParseDefineFlag(std::string const& definition, bool remove);
......
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