Commit 2649962d authored by Sebastien Barre's avatar Sebastien Barre
Browse files

FIX: although a CMakeLists.txt file could be searched up 'n' level in the...

FIX: although a CMakeLists.txt file could be searched up 'n' level in the directory tree, ReadListFile() always implied a CMakeLists.txt file was up *one* level.
parent e2294ae5
......@@ -270,21 +270,22 @@ bool cmMakefile::ReadListFile(const char* filename, const char* external)
std::string parentList = this->GetParentListFileName(filename);
if (parentList != "")
{
// save the current directory
std::string srcdir = m_cmCurrentDirectory;
std::string bindir = m_CurrentOutputDirectory;
// compute the new current directories
std::string::size_type pos = m_cmCurrentDirectory.rfind('/');
if(pos != std::string::npos)
{
m_cmCurrentDirectory = m_cmCurrentDirectory.substr(0, pos);
}
pos = m_CurrentOutputDirectory.rfind('/');
if(pos != std::string::npos)
std::string bindir = m_CurrentOutputDirectory;
std::string::size_type pos = parentList.rfind('/');
m_cmCurrentDirectory = parentList.substr(0, pos);
m_CurrentOutputDirectory = m_HomeOutputDirectory + parentList.substr(m_cmHomeDirectory.size(), pos - m_cmHomeDirectory.size());
// if not found, oops
if(pos == std::string::npos)
{
m_CurrentOutputDirectory = m_CurrentOutputDirectory.substr(0, pos);
cmSystemTools::Error("Trailing slash not found");
}
this->ReadListFile(parentList.c_str());
// restore the current directory
m_cmCurrentDirectory = srcdir;
m_CurrentOutputDirectory = bindir;
......@@ -803,7 +804,7 @@ std::string cmMakefile::GetParentListFileName(const char *currentFileName)
parentFile = listsDir;
parentFile += "/CMakeLists.txt";
}
return parentFile;
}
......
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