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.
This commit is contained in:
parent
bbfebcbc13
commit
327490e698
|
@ -564,6 +564,10 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
||||||
cmSystemTools::Error("Could not find cmake module file: ",
|
cmSystemTools::Error("Could not find cmake module file: ",
|
||||||
determineCompiler.c_str());
|
determineCompiler.c_str());
|
||||||
}
|
}
|
||||||
|
if (cmSystemTools::GetFatalErrorOccured())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
needTestLanguage[lang] = true;
|
needTestLanguage[lang] = true;
|
||||||
// Some generators like visual studio should not use the env variables
|
// Some generators like visual studio should not use the env variables
|
||||||
// So the global generator can specify that in this variable
|
// So the global generator can specify that in this variable
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
|
||||||
|
enable_language(Fail)
|
|
@ -0,0 +1 @@
|
||||||
|
message(FATAL_ERROR "This language is not supported.")
|
|
@ -4,3 +4,5 @@ run_cmake(NoLangSHARED)
|
||||||
run_cmake(LINK_LANGUAGE-genex)
|
run_cmake(LINK_LANGUAGE-genex)
|
||||||
run_cmake(link-libraries-TARGET_FILE-genex)
|
run_cmake(link-libraries-TARGET_FILE-genex)
|
||||||
run_cmake(link-libraries-TARGET_FILE-genex-ok)
|
run_cmake(link-libraries-TARGET_FILE-genex-ok)
|
||||||
|
|
||||||
|
run_cmake(DetermineFail)
|
||||||
|
|
Loading…
Reference in New Issue