diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2000-09-12 09:30:35 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2000-09-12 09:30:35 (GMT) |
commit | aa3ca2b432ab346c28ea7c758cbbf57ca346e139 (patch) | |
tree | dec236eb51e746ae123edb3e9c01a5595381e12f /Source/cmMakefile.cxx | |
parent | e2ad65d3c27177b8f3ee3c9b81382ea883a3bfbd (diff) | |
download | CMake-aa3ca2b432ab346c28ea7c758cbbf57ca346e139.zip CMake-aa3ca2b432ab346c28ea7c758cbbf57ca346e139.tar.gz CMake-aa3ca2b432ab346c28ea7c758cbbf57ca346e139.tar.bz2 |
ENH: CMake and configure now use SUBDIRS in CMakeLists.txt to find all the directories of the system.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 69 |
1 files changed, 11 insertions, 58 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 38792a5..3fa59a9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4,39 +4,11 @@ #include "cmMakefile.h" #include "cmClassFile.h" #include "cmDirectory.h" - +#include "cmSystemTools.h" #include <fstream> #include <iostream> -// remove extra spaces and the "\" character from the name -// of the class as it is in the CMakeLists.txt -inline std::string CleanUpName(const char* name) -{ - std::string className = name; - size_t i =0; - while(className[i] == ' ') - { - i++; - } - if(i) - { - className = className.substr(i, className.size()); - } - size_t pos = className.find('\\'); - if(pos != std::string::npos) - { - className = className.substr(0, pos); - } - - pos = className.find(' '); - if(pos != std::string::npos) - { - className = className.substr(0, pos); - } - return className; -} - // default is not to be building executables cmMakefile::cmMakefile() { @@ -55,7 +27,10 @@ void cmMakefile::Print() bool cmMakefile::ReadMakefile(const char* filename) { - std::cerr << "reading makefile " << filename << std::endl; + m_BuildFlags.SetSourceHomeDirectory(this->GetHomeDirectory()); + m_BuildFlags.SetStartDirectory(this->GetCurrentDirectory()); + m_BuildFlags.ParseDirectories(); + std::ifstream fin(filename); if(!fin) { @@ -106,7 +81,7 @@ bool cmMakefile::ReadMakefile(const char* filename) { if(line.find("\\") != std::string::npos) { - this->ReadSubdirs(fin); + cmSystemTools::ReadList(m_SubDirectories, fin); } } else if(line.find("EXECUTABLES") != std::string::npos) @@ -177,7 +152,7 @@ void cmMakefile::ReadClasses(std::ifstream& fin, done = true; } // remove extra spaces and \ from the class name - classname = CleanUpName(classname.c_str()); + classname = cmSystemTools::CleanUpName(classname.c_str()); // if this is not an abstract list then add new class // to the list of classes in this makefile @@ -204,6 +179,9 @@ void cmMakefile::ReadClasses(std::ifstream& fin, } } +// Find all of the files in dir as specified from this line: +// TEMPLATE_INSTANCE_DIRECTORY = dir +// Add all the files to the m_Classes array. void cmMakefile::ReadTemplateInstanceDirectory(std::string& line) { @@ -211,7 +189,7 @@ void cmMakefile::ReadTemplateInstanceDirectory(std::string& line) if(start != std::string::npos) { std::string dirname = line.substr(start+1, line.size()); - dirname = CleanUpName(dirname.c_str()); + dirname = cmSystemTools::CleanUpName(dirname.c_str()); std::string tdir = this->GetCurrentDirectory(); tdir += "/"; tdir += dirname; @@ -250,28 +228,3 @@ void cmMakefile::ReadTemplateInstanceDirectory(std::string& line) } - -// Read a list of subdirectories from the stream -void cmMakefile::ReadSubdirs(std::ifstream& fin) -{ - char inbuffer[2048]; - bool done = false; - - while (!done) - { - // read a line from the makefile - fin.getline(inbuffer, 2047); - // convert to a string class - std::string dir = inbuffer; - // if the line does not end in \ then we are at the - // end of the list - if(dir.find('\\') == std::string::npos) - { - done = true; - } - // remove extra spaces and \ from the class name - dir = CleanUpName(dir.c_str()); - m_SubDirectories.push_back(dir); - } -} - |