diff options
author | Brad King <brad.king@kitware.com> | 2015-06-29 18:51:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-06-29 20:18:32 (GMT) |
commit | 327490e698db7a74f6a8e8543e99c6c7c9333a8f (patch) | |
tree | 3ceec17b8606008feab64847b89323a9782f9708 | |
parent | bbfebcbc13df87173dd8cb59cd34e1e0b3e1c0cc (diff) | |
download | CMake-327490e698db7a74f6a8e8543e99c6c7c9333a8f.zip CMake-327490e698db7a74f6a8e8543e99c6c7c9333a8f.tar.gz CMake-327490e698db7a74f6a8e8543e99c6c7c9333a8f.tar.bz2 |
enable_language: Allow CMakeDetermine<LANG>Compiler module to fail early
If the module reports a FATAL_ERROR, skip the rest of the steps to
enable the language to avoid unnecessary following error messages.
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 4 | ||||
-rw-r--r-- | Tests/RunCMake/Languages/DetermineFail-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Languages/DetermineFail-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/Languages/DetermineFail.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Languages/RunCMakeTest.cmake | 2 |
6 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 14eaeac..23ab93d 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -564,6 +564,10 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& 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 0000000..d00491f --- /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 0000000..3b4743e --- /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 0000000..3c8d17d --- /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 0000000..3b2d50a --- /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 6517a81..732baae 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) |