mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Merge topic 'try_compile-enabled-languages'
39cc425791 try_compile: Restore toleration of toolchain file setting internal variable
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12300
This commit is contained in:
@@ -858,8 +858,11 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
this->SetLanguageEnabled("NONE", mf);
|
||||
continue;
|
||||
}
|
||||
std::string loadedLang = cmStrCat("CMAKE_", lang, "_COMPILER_LOADED");
|
||||
if (!mf->GetDefinition(loadedLang)) {
|
||||
// Compiler information may have already been detected and saved.
|
||||
// Load it if we have not enabled the language anywhere yet, or
|
||||
// if we have not loaded compiler information in this directory.
|
||||
if (!this->GetLanguageEnabled(lang) ||
|
||||
!mf->GetDefinition(cmStrCat("CMAKE_", lang, "_COMPILER_LOADED"))) {
|
||||
fpath = cmStrCat(rootBin, "/CMake", lang, "Compiler.cmake");
|
||||
|
||||
// If the existing build tree was already configured with this
|
||||
|
||||
@@ -14,6 +14,7 @@ run_cmake_toolchain(LinkFlagsInit)
|
||||
run_cmake_toolchain(CMP0126-NEW)
|
||||
run_cmake_toolchain(CMP0126-OLD)
|
||||
run_cmake_toolchain(CMP0126-WARN)
|
||||
run_cmake_toolchain(SetCompilerLoaded)
|
||||
run_cmake_toolchain(SetCrossCompiling)
|
||||
|
||||
function(run_IncludeDirectories)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
set(CMAKE_C_COMPILER_LOADED 1)
|
||||
@@ -0,0 +1,5 @@
|
||||
enable_language(C)
|
||||
try_compile(SHOULD_PASS SOURCE_FROM_CONTENT "main.c" "int main(void) { return 0; }")
|
||||
if(NOT SHOULD_PASS)
|
||||
message(FATAL_ERROR "try_compile failed but should have passed!")
|
||||
endif()
|
||||
Reference in New Issue
Block a user