diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-11-21 14:59:41 -0500 |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-11-21 14:59:41 -0500 |
commit | c544cb43078a92c7c04ef4ebccb36310765b6487 (patch) | |
tree | 43dd2e930c522c162e37ba63a2dcce90b8b84441 /Source/cmTryCompileCommand.cxx | |
parent | 1e3ddfeecf636a5337eb57bd9959f5d738eed184 (diff) | |
download | cmake-c544cb43078a92c7c04ef4ebccb36310765b6487.tar.gz |
clean up entire temp directory
Diffstat (limited to 'Source/cmTryCompileCommand.cxx')
-rw-r--r-- | Source/cmTryCompileCommand.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index a2c2af8a06..44752eb8d6 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -229,22 +229,19 @@ bool cmTryCompileCommand::InitialPass(std::vector<std::string> const& argv) static void cmTryCompileCommandNotUsed(bool){} -void cmTryCompileCommand::CleanupFiles(const char* binDir, bool recursive) +void cmTryCompileCommand::CleanupFiles(const char* binDir) { if ( !binDir ) { return; } - cmTryCompileCommandNotUsed(recursive); -#ifdef WIN32 - if ( recursive ) + std::string bdir = binDir; + if(bdir.find("CMakeTmp") == std::string::npos) { - std::string bdir = binDir; - bdir += "/Debug"; - cmTryCompileCommand::CleanupFiles(bdir.c_str(), false); + cmSystemTools::Error("TRY_COMPILE attempt to remove -rf directory that does not contain CMakeTmp:", binDir); + return; } -#endif - + cmDirectory dir; dir.Load(binDir); size_t fileNum; @@ -256,7 +253,14 @@ void cmTryCompileCommand::CleanupFiles(const char* binDir, bool recursive) std::string fullPath = binDir; fullPath += "/"; fullPath += dir.GetFile(fileNum); - cmSystemTools::RemoveFile(fullPath.c_str()); + if(cmSystemTools::FileIsDirectory(fullPath.c_str())) + { + cmTryCompileCommand::CleanupFiles(fullPath.c_str()); + } + else + { + cmSystemTools::RemoveFile(fullPath.c_str()); + } } } } |