summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-08-21 14:59:48 (GMT)
committerBrad King <brad.king@kitware.com>2012-08-22 20:35:54 (GMT)
commitec22a9b5217c2110db9af1791a61a7552144f028 (patch)
treeaf92b761c64c80fabfcd902c573af24f492a9c7b /Source
parent66cb3356f508da309d599f6148763f7afe3802e1 (diff)
downloadCMake-ec22a9b5217c2110db9af1791a61a7552144f028.zip
CMake-ec22a9b5217c2110db9af1791a61a7552144f028.tar.gz
CMake-ec22a9b5217c2110db9af1791a61a7552144f028.tar.bz2
Cleanly enable a language in multiple subdirectories
When a language is not enabled at the top level of a project but is enabled in multiple disjoint subdirectories we should re-use the CMake<lang>Compiler.cmake file from the first directory. Load the file whenever it exists and is not left from a different version of CMake.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx24
1 files changed, 13 insertions, 11 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index a47ca36..52b451c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -376,22 +376,24 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
std::string loadedLang = "CMAKE_";
loadedLang += lang;
loadedLang += "_COMPILER_LOADED";
- // 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 = cmVersion::GetMajorVersion();
- unsigned int selfMinor = cmVersion::GetMinorVersion();
- if((this->CMakeInstance->GetIsInTryCompile() ||
- (selfMajor == cacheMajor && selfMinor == cacheMinor))
- && !mf->GetDefinition(loadedLang.c_str()))
+ if(!mf->GetDefinition(loadedLang.c_str()))
{
fpath = rootBin;
fpath += "/CMake";
fpath += lang;
fpath += "Compiler.cmake";
- if(cmSystemTools::FileExists(fpath.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 = cmVersion::GetMajorVersion();
+ unsigned int selfMinor = cmVersion::GetMinorVersion();
+ if((this->CMakeInstance->GetIsInTryCompile() ||
+ (cacheMajor == 0 && cacheMinor == 0) ||
+ (selfMajor == cacheMajor && selfMinor == cacheMinor)) &&
+ cmSystemTools::FileExists(fpath.c_str()))
{
if(!mf->ReadListFile(0,fpath.c_str()))
{