diff options
author | Alexander Neundorf <neundorf@kde.org> | 2008-06-10 22:28:01 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2008-06-10 22:28:01 (GMT) |
commit | 3e909b5908c1fe89d9e944364e951e25c7b14f88 (patch) | |
tree | f471515c3e2226a65b885d2bcccdfbb2d74d02cf /Source/cmGlobalGenerator.cxx | |
parent | 4543a3ea05433b45bfea317e168a61354ea20ad4 (diff) | |
download | CMake-3e909b5908c1fe89d9e944364e951e25c7b14f88.zip CMake-3e909b5908c1fe89d9e944364e951e25c7b14f88.tar.gz CMake-3e909b5908c1fe89d9e944364e951e25c7b14f88.tar.bz2 |
BUG: -fail with error if the CMake<LANG>Information.cmake file wasn't found
ENH: -if no compiler has been found, don't test it, and also remove the compiler
information file again. This makes optionally enabling a language work
better.
Alex
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index aa7c6f5..e6436e4 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -410,23 +410,43 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, fpath = "CMake"; fpath += lang; fpath += "Information.cmake"; - fpath = mf->GetModulesFile(fpath.c_str()); - if(!mf->ReadListFile(0,fpath.c_str())) + std::string informationFile = mf->GetModulesFile(fpath.c_str()); + if (informationFile.empty()) { cmSystemTools::Error("Could not find cmake module file:", fpath.c_str()); } + else if(!mf->ReadListFile(0, informationFile.c_str())) + { + cmSystemTools::Error("Could not process cmake module file:", + informationFile.c_str()); + } } if (needSetLanguageEnabledMaps[lang]) { this->SetLanguageEnabledMaps(lang, mf); } + std::string compilerName = "CMAKE_"; + compilerName += lang; + compilerName += "_COMPILER"; + std::string compilerLangFile = rootBin; + compilerLangFile += "/CMake"; + compilerLangFile += lang; + compilerLangFile += "Compiler.cmake"; // Test the compiler for the language just setup + // (but only if a compiler has been actually found) // At this point we should have enough info for a try compile // which is used in the backward stuff // If the language is untested then test it now with a try compile. - if(needTestLanguage[lang]) + if (!mf->IsSet(compilerName.c_str())) + { + // if the compiler did not work, then remove the + // CMake(LANG)Compiler.cmake file so that it will get tested the + // next time cmake is run + cmSystemTools::RemoveFile(compilerLangFile.c_str()); + } + else if(needTestLanguage[lang]) { if (!this->CMakeInstance->GetIsInTryCompile()) { @@ -447,11 +467,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, // next time cmake is run if(!mf->IsOn(compilerWorks.c_str())) { - fpath = rootBin; - fpath += "/CMake"; - fpath += lang; - fpath += "Compiler.cmake"; - cmSystemTools::RemoveFile(fpath.c_str()); + cmSystemTools::RemoveFile(compilerLangFile.c_str()); } else { |