summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-02-24 15:32:58 (GMT)
committerBrad King <brad.king@kitware.com>2005-02-24 15:32:58 (GMT)
commit2e451961b68e460153600dc5967c21676cb20234 (patch)
tree99343c6d1cce12a910897f247a9db405e6b93189 /Source/cmGlobalGenerator.cxx
parentdf301a254204b009ae334a6236b583997301232e (diff)
downloadCMake-2e451961b68e460153600dc5967c21676cb20234.zip
CMake-2e451961b68e460153600dc5967c21676cb20234.tar.gz
CMake-2e451961b68e460153600dc5967c21676cb20234.tar.bz2
BUG: Only use the existing CMake(lang)Compiler.cmake file from the build tree if it was generated by the same version of CMake.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx36
1 files changed, 23 insertions, 13 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f194e08..296a008 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -207,23 +207,33 @@ void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
"broken CMakeLists.txt file or a problematic release of "
"CMake");
}
- // try and load the configured file first
- std::string loadedLang = "CMAKE_";
- loadedLang += lang;
- loadedLang += "_COMPILER_LOADED";
- if(!mf->GetDefinition(loadedLang.c_str()))
+
+ // If the existing build tree was already configured with this
+ // version of CMake then try to load the configured file first
+ // to avoid duplicate compiler tests.
+ unsigned int cacheMajor = mf->GetCacheMajorVersion();
+ unsigned int cacheMinor = mf->GetCacheMinorVersion();
+ unsigned int selfMajor = cmMakefile::GetMajorVersion();
+ unsigned int selfMinor = cmMakefile::GetMinorVersion();
+ if(selfMajor == cacheMajor && selfMinor == cacheMinor)
{
- fpath = rootBin;
- fpath += "/CMake";
- fpath += lang;
- fpath += "Compiler.cmake";
- if(cmSystemTools::FileExists(fpath.c_str()))
+ std::string loadedLang = "CMAKE_";
+ loadedLang += lang;
+ loadedLang += "_COMPILER_LOADED";
+ if(!mf->GetDefinition(loadedLang.c_str()))
{
- if(!mf->ReadListFile(0,fpath.c_str()))
+ fpath = rootBin;
+ fpath += "/CMake";
+ fpath += lang;
+ fpath += "Compiler.cmake";
+ if(cmSystemTools::FileExists(fpath.c_str()))
{
- cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
+ if(!mf->ReadListFile(0,fpath.c_str()))
+ {
+ cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
+ }
+ this->SetLanguageEnabled(lang, mf);
}
- this->SetLanguageEnabled(lang, mf);
}
}