diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-11 21:02:10 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-11 21:02:10 (GMT) |
commit | 789267c94903f23d231e16de6ff50a2926dcf8e4 (patch) | |
tree | 8effdfe67c6a239421ca6977ff21675de2552bff /Source | |
parent | cdc65cfebfc0a2f5b0ecbc0a61d3f14c4989955a (diff) | |
download | CMake-789267c94903f23d231e16de6ff50a2926dcf8e4.zip CMake-789267c94903f23d231e16de6ff50a2926dcf8e4.tar.gz CMake-789267c94903f23d231e16de6ff50a2926dcf8e4.tar.bz2 |
ENH: speed improvements
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmFindFileCommand.h | 2 | ||||
-rw-r--r-- | Source/cmFindLibraryCommand.h | 2 | ||||
-rw-r--r-- | Source/cmFindPathCommand.h | 2 | ||||
-rw-r--r-- | Source/cmFindProgramCommand.h | 2 | ||||
-rw-r--r-- | Source/cmIncludeCommand.cxx | 18 | ||||
-rw-r--r-- | Source/cmListFileCache.cxx | 7 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 1 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 63 |
8 files changed, 28 insertions, 69 deletions
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h index e957719..f55e32d 100644 --- a/Source/cmFindFileCommand.h +++ b/Source/cmFindFileCommand.h @@ -49,7 +49,7 @@ public: * This determines if the command gets propagated down * to makefiles located in subdirectories. */ - virtual bool IsInherited() { return true; } + virtual bool IsInherited() { return false; } /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index 7c4a75a..ffa9a81 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -49,7 +49,7 @@ public: * This determines if the command gets propagated down * to makefiles located in subdirectories. */ - virtual bool IsInherited() {return true;} + virtual bool IsInherited() {return false;} /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index 273e921d..8241908 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -49,7 +49,7 @@ public: * This determines if the command gets propagated down * to makefiles located in subdirectories. */ - virtual bool IsInherited() {return true;} + virtual bool IsInherited() {return false;} /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 13e79ad..ae21338 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -49,7 +49,7 @@ public: * This determines if the command gets propagated down * to makefiles located in subdirectories. */ - virtual bool IsInherited() { return true; } + virtual bool IsInherited() { return false; } /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 6cda4a5..54308e4 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -25,19 +25,21 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args) this->SetError("called with wrong number of arguments. " "Include only takes one file."); } - bool exists = cmSystemTools::FileExists(args[0].c_str()); - if(args.size() == 2 && args[1] == "OPTIONAL" && !exists) + bool optional = false; + if(args.size() == 2) { - return true; + optional = args[1] == "OPTIONAL"; } - if(!exists) + + bool readit = m_Makefile->ReadListFile( m_Makefile->GetCurrentListFile(), + args[0].c_str()); + if(!optional && !readit) { - std::string error = "Include file not found: " + args[0] + "\n"; - this->SetError(error.c_str()); + std::string m = "Could not find include file:"; + m += args[0]; + this->SetError(m.c_str()); return false; } - m_Makefile->ReadListFile( m_Makefile->GetCurrentListFile(), - args[0].c_str()); return true; } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 2e0020d..fcfd75c 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -77,10 +77,15 @@ cmListFile* cmListFileCache::GetFileCache(const char* path) bool cmListFileCache::CacheFile(const char* path) { + if(!cmSystemTools::FileExists(path)) + { + return false; + } + std::ifstream fin(path); if(!fin) { - cmSystemTools::Error("error can not open file ", path); + cmSystemTools::Error("cmListFileCache: error can not open file ", path); return false; } std::string name; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5cca930..5a2071c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -323,7 +323,6 @@ bool cmMakefile::ReadListFile(const char* filename, const char* external) cmListFileCache::GetInstance()->GetFileCache(filenametoread); if(!lf) { - cmSystemTools::Error("error can not open file ", filenametoread); return false; } // add this list file to the list of dependencies diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 22acac8..bb0a86b 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -972,61 +972,14 @@ bool cmSystemTools::FilesDiffer(const char* source, { return true; } - const int buffer_length = 4096; - char bufferSource[buffer_length]; - char bufferDest[buffer_length]; - while(finSource && finDestination) - { - if(finSource.getline(bufferSource, buffer_length, '\n') - || finSource.gcount()) - { - if(finDestination.getline(bufferDest, buffer_length, '\n') - || finDestination.gcount()) - { - // both if statements passed - if(finSource.eof()) - { - if(!finDestination.eof()) - { - return true; - } - if(finSource.gcount() != finDestination.gcount()) - { - return true; - } - if(strncmp(bufferSource, bufferDest, finSource.gcount()) != 0) - { - return true; - } - } - else if(finSource.fail()) - { - if(!finDestination.fail()) - { - return true; - } - if(strcmp(bufferSource, bufferDest) != 0) - { - return true; - } - finSource.clear(finSource.rdstate() & ~std::ios::failbit); - finDestination.clear(finDestination.rdstate() & ~std::ios::failbit); - } - else - { - if(strcmp(bufferSource, bufferDest) != 0) - { - return true; - } - } - } - else - { - return true; - } - } - } - return false; + char* buffer1 = new char[statSource.st_size]; + char* buffer2 = new char[statSource.st_size]; + finSource.read(buffer1, statSource.st_size); + finDestination.read(buffer2, statSource.st_size); + int ret = memcmp(buffer1, buffer2, statSource.st_size); + delete [] buffer2; + delete [] buffer1; + return ret != 0; } |