Merge topic 'GNU-linker-pushpop_state-detection' into release-4.0

d5be7c7f31 Linker: Detect GNU push-state/pop-state flags more robustly
7b552b9a64 Linker: Save GNU push-/pop-state detection with compiler inspection results
a9b126b0da Linker: Save linker inspection results with compiler inspection results
3f5f2b2d49 Linker: Honor CMAKE_<LANG>_LINK_LIBRARY_USING_FEATURE_SUPPORTED when FALSE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10468
This commit is contained in:
Brad King
2025-03-21 12:06:29 +00:00
committed by Kitware Robot
25 changed files with 169 additions and 20 deletions
+2 -2
View File
@@ -193,8 +193,8 @@ bool IsFeatureSupported(cmMakefile* makefile, std::string const& linkLanguage,
{
auto featureSupported = cmStrCat(
"CMAKE_", linkLanguage, "_LINK_LIBRARY_USING_", feature, "_SUPPORTED");
if (makefile->GetDefinition(featureSupported).IsOn()) {
return true;
if (cmValue perLangVar = makefile->GetDefinition(featureSupported)) {
return perLangVar.IsOn();
}
featureSupported =
+15 -3
View File
@@ -941,9 +941,9 @@ void cmGlobalGenerator::EnableLanguage(
} // end if in try compile
} // end need test language
// load linker configuration, if required
if (mf->GetDefinition(cmStrCat("CMAKE_", lang, "_USE_LINKER_INFORMATION"))
.IsOn()) {
// load linker configuration, if required
if (mf->IsOn(cmStrCat("CMAKE_", lang, "_COMPILER_WORKS")) &&
mf->IsOn(cmStrCat("CMAKE_", lang, "_USE_LINKER_INFORMATION"))) {
std::string langLinkerLoadedVar =
cmStrCat("CMAKE_", lang, "_LINKER_INFORMATION_LOADED");
if (!mf->GetDefinition(langLinkerLoadedVar)) {
@@ -960,6 +960,18 @@ void cmGlobalGenerator::EnableLanguage(
"Could not process cmake module file: ", informationFile));
}
}
if (needTestLanguage[lang]) {
if (!this->CMakeInstance->GetIsInTryCompile()) {
std::string testLang =
cmStrCat("Internal/CMakeInspect", lang, "Linker.cmake");
std::string ifpath = mf->GetModulesFile(testLang);
if (!mf->ReadListFile(ifpath)) {
cmSystemTools::Error(
cmStrCat("Could not find cmake module file: ", testLang));
}
}
}
}
// Translate compiler ids for compatibility.