diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 14eaeac7a..23ab93de8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -564,6 +564,10 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, cmSystemTools::Error("Could not find cmake module file: ", determineCompiler.c_str()); } + if (cmSystemTools::GetFatalErrorOccured()) + { + return; + } needTestLanguage[lang] = true; // Some generators like visual studio should not use the env variables // So the global generator can specify that in this variable diff --git a/Tests/RunCMake/Languages/DetermineFail-result.txt b/Tests/RunCMake/Languages/DetermineFail-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Languages/DetermineFail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Languages/DetermineFail-stderr.txt b/Tests/RunCMake/Languages/DetermineFail-stderr.txt new file mode 100644 index 000000000..3b4743e15 --- /dev/null +++ b/Tests/RunCMake/Languages/DetermineFail-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at Modules/CMakeDetermineFailCompiler.cmake:[0-9]+ \(message\): + This language is not supported. +Call Stack \(most recent call first\): + DetermineFail.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Languages/DetermineFail.cmake b/Tests/RunCMake/Languages/DetermineFail.cmake new file mode 100644 index 000000000..3c8d17d8f --- /dev/null +++ b/Tests/RunCMake/Languages/DetermineFail.cmake @@ -0,0 +1,2 @@ +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules) +enable_language(Fail) diff --git a/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake b/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake new file mode 100644 index 000000000..3b2d50a34 --- /dev/null +++ b/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This language is not supported.") diff --git a/Tests/RunCMake/Languages/RunCMakeTest.cmake b/Tests/RunCMake/Languages/RunCMakeTest.cmake index 6517a8105..732baae41 100644 --- a/Tests/RunCMake/Languages/RunCMakeTest.cmake +++ b/Tests/RunCMake/Languages/RunCMakeTest.cmake @@ -4,3 +4,5 @@ run_cmake(NoLangSHARED) run_cmake(LINK_LANGUAGE-genex) run_cmake(link-libraries-TARGET_FILE-genex) run_cmake(link-libraries-TARGET_FILE-genex-ok) + +run_cmake(DetermineFail)