summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-02-21 04:08:12 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-02-21 04:08:12 (GMT)
commite015df7d06a2b591571228cba10c5268a8f8fccd (patch)
tree3b25646b59d65a98d7a34edeeda9ac895d4bb0bc
parent2cb68f60003d0dbe9a2f91663ebca7de3b16c8f1 (diff)
downloadCMake-e015df7d06a2b591571228cba10c5268a8f8fccd.zip
CMake-e015df7d06a2b591571228cba10c5268a8f8fccd.tar.gz
CMake-e015df7d06a2b591571228cba10c5268a8f8fccd.tar.bz2
ENH: better finding of mingw from msys, and delete CMakeFiles directory when cache is deleted
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake5
-rw-r--r--Source/cmCacheManager.cxx19
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx25
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.h3
4 files changed, 50 insertions, 2 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index cd74194..0c59db3 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -41,7 +41,10 @@ IF(NOT CMAKE_C_COMPILER)
SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler")
ENDIF(NOT CMAKE_C_COMPILER)
MARK_AS_ADVANCED(CMAKE_C_COMPILER)
-FIND_PROGRAM(CMAKE_AR NAMES ar PATHS /mingw/bin c:/mingw/bin /msys/1.0/bin c:/msys/1.0/bin )
+GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_C_COMPILER}"
+ PATH)
+
+FIND_PROGRAM(CMAKE_AR NAMES ar PATHS ${COMPILER_LOCATION} )
FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib)
IF(NOT CMAKE_RANLIB)
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index ece2084..055e9f1 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -19,6 +19,7 @@
#include "cmSystemTools.h"
#include "cmCacheManager.h"
#include "cmMakefile.h"
+#include <cmsys/Directory.hxx>
#include <cmsys/RegularExpression.hxx>
@@ -580,8 +581,26 @@ bool cmCacheManager::SaveCache(const char* path)
bool cmCacheManager::DeleteCache(const char* path)
{
std::string cacheFile = path;
+ cmSystemTools::ConvertToUnixSlashes(cacheFile);
+ std::string cmakeFiles = cacheFile;
cacheFile += "/CMakeCache.txt";
cmSystemTools::RemoveFile(cacheFile.c_str());
+ // now remove the files in the CMakeFiles directory
+ // this cleans up language cache files
+ cmsys::Directory dir;
+ cmakeFiles += "/CMakeFiles";
+ dir.Load(cmakeFiles.c_str());
+ for (unsigned long fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum)
+ {
+ if(!cmSystemTools::
+ FileIsDirectory(dir.GetFile(fileNum)))
+ {
+ std::string fullPath = cmakeFiles;
+ fullPath += "/";
+ fullPath += dir.GetFile(fileNum);
+ cmSystemTools::RemoveFile(fullPath.c_str());
+ }
+ }
return true;
}
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index fdae0b9..8643857 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -25,13 +25,36 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
m_ForceUnixPaths = true;
}
+std::string
+cmGlobalMSYSMakefileGenerator::FindMinGW(std::string const& makeloc)
+{
+ std::string fstab = makeloc;
+ fstab += "/../etc/fstab";
+ std::ifstream fin(fstab.c_str());
+ std::string path;
+ std::string mount;
+ while(fin)
+ {
+ fin >> path;
+ fin >> mount;
+ if(mount == "/mingw")
+ {
+ path += "/bin";
+ return path;
+ }
+ }
+ return "";
+}
+
void cmGlobalMSYSMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
cmMakefile *mf)
{
this->FindMakeProgram(mf);
std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
std::vector<std::string> locations;
- locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str()));
+ std::string makeloc = cmSystemTools::GetProgramPath(makeProgram.c_str());
+ locations.push_back(makeloc);
+ locations.push_back(this->FindMinGW(makeloc));
locations.push_back("/mingw/bin");
locations.push_back("/msys/1.0/bin");
locations.push_back("c:/mingw/bin");
diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h
index 4905f70..ba56d84 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.h
+++ b/Source/cmGlobalMSYSMakefileGenerator.h
@@ -45,6 +45,9 @@ public:
* extension, pthreads, byte order etc.
*/
virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
+
+private:
+ std::string FindMinGW(std::string const& makeloc);
};
#endif