diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-03-09 20:47:18 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-03-09 20:47:18 (GMT) |
commit | 8cdb87eaa75803d379f3645fa03df046e87e9497 (patch) | |
tree | 70a10b535c3e101947dfa619aa6b4e8215594993 /Source/cmCacheManager.cxx | |
parent | 15b5869b46d03dbd785c00ce71cee38225a3420a (diff) | |
download | CMake-8cdb87eaa75803d379f3645fa03df046e87e9497.zip CMake-8cdb87eaa75803d379f3645fa03df046e87e9497.tar.gz CMake-8cdb87eaa75803d379f3645fa03df046e87e9497.tar.bz2 |
ENH: if CMakeCache.txt has been removed, then automatically remove CMakefiles/*.cmake
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r-- | Source/cmCacheManager.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 055e9f1..6be0c35 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -19,6 +19,7 @@ #include "cmSystemTools.h" #include "cmCacheManager.h" #include "cmMakefile.h" +#include "cmGlob.h" #include <cmsys/Directory.hxx> #include <cmsys/RegularExpression.hxx> @@ -154,6 +155,20 @@ bool cmCacheManager::ParseEntry(const char* entry, return flag; } +void cmCacheManager::CleanCMakeFiles(const char* path) +{ + std::string glob = path; + glob += "/CMakeFiles/*.cmake"; + cmGlob globIt; + globIt.FindFiles(glob); + std::vector<std::string> files = globIt.GetFiles(); + for(std::vector<std::string>::iterator i = files.begin(); + i != files.end(); ++i) + { + cmSystemTools::RemoveFile(i->c_str()); + } +} + bool cmCacheManager::LoadCache(const char* path, bool internal, std::set<cmStdString>& excludes, @@ -166,6 +181,12 @@ bool cmCacheManager::LoadCache(const char* path, { m_Cache.clear(); } + if(!cmSystemTools::FileExists(cacheFile.c_str())) + { + this->CleanCMakeFiles(path); + return false; + } + std::ifstream fin(cacheFile.c_str()); if(!fin) { |