summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Barre <sebastien.barre@kitware.com>2002-02-25 20:06:18 (GMT)
committerSebastien Barre <sebastien.barre@kitware.com>2002-02-25 20:06:18 (GMT)
commit2649962d65a73307541b48e3da258ed96aa2bcb9 (patch)
treebdbaa50448ec9a9a37604bd2e725c565edaf41df
parente2294ae59116b0b7cd90f9648070ba9c2638c83c (diff)
downloadCMake-2649962d65a73307541b48e3da258ed96aa2bcb9.zip
CMake-2649962d65a73307541b48e3da258ed96aa2bcb9.tar.gz
CMake-2649962d65a73307541b48e3da258ed96aa2bcb9.tar.bz2
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.
-rw-r--r--Source/cmMakefile.cxx25
1 files changed, 13 insertions, 12 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index deead3e..d863ca3 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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;
}