summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-27 19:39:55 (GMT)
committerBrad King <brad.king@kitware.com>2011-01-27 19:39:55 (GMT)
commitdd2f81491e6e17681dd18882a8ccfa01fa32a3f7 (patch)
tree6b782de32aeb462333d70747f269b1725e723e00 /Source/cmCoreTryCompile.cxx
parent949d32c3067830a1376950fc78dbcde39bc378a8 (diff)
parent7679f9fab099e729b61320927a9e0b8d03546f7f (diff)
downloadCMake-dd2f81491e6e17681dd18882a8ccfa01fa32a3f7.zip
CMake-dd2f81491e6e17681dd18882a8ccfa01fa32a3f7.tar.gz
CMake-dd2f81491e6e17681dd18882a8ccfa01fa32a3f7.tar.bz2
Merge branch 'dev/add_test-working-directory' into dev/strict-mode
Conflicts: Tests/CMakeLists.txt
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx37
1 files changed, 14 insertions, 23 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 30356c8..75f9824 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -169,8 +169,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
const char* lang =(this->Makefile->GetCMakeInstance()->GetGlobalGenerator()
->GetLanguageFromExtension(ext.c_str()));
const char* def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH");
- fprintf(fout, "cmake_minimum_required(VERSION %u.%u)\n",
- cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion());
+ fprintf(fout, "cmake_minimum_required(VERSION %u.%u.%u.%u)\n",
+ cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion(),
+ cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion());
if(def)
{
fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def);
@@ -394,28 +395,18 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
}
else
{
- if(!cmSystemTools::RemoveFile(fullPath.c_str()))
+ // Sometimes anti-virus software hangs on to new files so we
+ // cannot delete them immediately. Try a few times.
+ int tries = 5;
+ while(!cmSystemTools::RemoveFile(fullPath.c_str()) &&
+ --tries && cmSystemTools::FileExists(fullPath.c_str()))
{
- bool removed = false;
- int numAttempts = 0;
- // sometimes anti-virus software hangs on to
- // new files and we can not delete them, so try
- // 5 times with .5 second delay between tries.
- while(!removed && numAttempts < 5)
- {
- cmSystemTools::Delay(500);
- if(cmSystemTools::RemoveFile(fullPath.c_str()))
- {
- removed = true;
- }
- numAttempts++;
- }
- if(!removed)
- {
- std::string m = "Remove failed on file: ";
- m += fullPath;
- cmSystemTools::ReportLastSystemError(m.c_str());
- }
+ cmSystemTools::Delay(500);
+ }
+ if(tries == 0)
+ {
+ std::string m = "Remove failed on file: " + fullPath;
+ cmSystemTools::ReportLastSystemError(m.c_str());
}
}
}