summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx54
1 files changed, 31 insertions, 23 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index d636cb8..25b3216 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -173,12 +173,30 @@ 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);
}
+
+ const char* rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE";
+ std::string rulesOverrideLang =
+ rulesOverrideBase + (lang ? std::string("_") + lang : std::string(""));
+ if(const char* rulesOverridePath =
+ this->Makefile->GetDefinition(rulesOverrideLang.c_str()))
+ {
+ fprintf(fout, "SET(%s \"%s\")\n",
+ rulesOverrideLang.c_str(), rulesOverridePath);
+ }
+ else if(const char* rulesOverridePath2 =
+ this->Makefile->GetDefinition(rulesOverrideBase))
+ {
+ fprintf(fout, "SET(%s \"%s\")\n",
+ rulesOverrideBase, rulesOverridePath2);
+ }
+
if(lang)
{
fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE %s)\n", lang);
@@ -382,28 +400,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()))
+ {
+ cmSystemTools::Delay(500);
+ }
+ if(tries == 0)
{
- 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());
- }
+ std::string m = "Remove failed on file: " + fullPath;
+ cmSystemTools::ReportLastSystemError(m.c_str());
}
}
}