diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2024-10-24 14:34:58 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2024-10-24 14:37:30 (GMT) |
commit | 0619c064ff79a794e1d0e477fa27534c0ddd5041 (patch) | |
tree | a53fedc4a6700178bec57f9353dcd3e4bd643349 /Source | |
parent | 5b2351fb39f02a033ade4ab9fa2d2e9f3e58afbe (diff) | |
download | CMake-0619c064ff79a794e1d0e477fa27534c0ddd5041.zip CMake-0619c064ff79a794e1d0e477fa27534c0ddd5041.tar.gz CMake-0619c064ff79a794e1d0e477fa27534c0ddd5041.tar.bz2 |
Linker configuration: enhance usability
The linker configuration file is now optional: It is loaded only if
variable CMAKE_<LANG>_USE_LINKER_CONFIGURATION is set to TRUE.
The file CMakeAddNewLanguage.txt is updated to take into account the
linker configuration.
Fixes: #26393
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ec44817..e3a38b0 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -963,18 +963,24 @@ void cmGlobalGenerator::EnableLanguage( } // end if in try compile } // end need test language - // load linker configuration - std::string langLinkerLoadedVar = - cmStrCat("CMAKE_", lang, "_LINKER_INFORMATION_LOADED"); - if (!mf->GetDefinition(langLinkerLoadedVar)) { - fpath = cmStrCat("Internal/CMake", lang, "LinkerInformation.cmake"); - std::string informationFile = mf->GetModulesFile(fpath); - if (informationFile.empty()) { - cmSystemTools::Error( - cmStrCat("Could not find cmake module file: ", fpath)); - } else if (!mf->ReadListFile(informationFile)) { - cmSystemTools::Error( - cmStrCat("Could not process cmake module file: ", informationFile)); + // load linker configuration, if required + if (mf->GetDefinition(cmStrCat("CMAKE_", lang, "_USE_LINKER_INFORMATION")) + .IsOn()) { + std::string langLinkerLoadedVar = + cmStrCat("CMAKE_", lang, "_LINKER_INFORMATION_LOADED"); + if (!mf->GetDefinition(langLinkerLoadedVar)) { + fpath = cmStrCat("CMake", lang, "LinkerInformation.cmake"); + std::string informationFile = mf->GetModulesFile(fpath); + if (informationFile.empty()) { + informationFile = mf->GetModulesFile(cmStrCat("Internal/", fpath)); + } + if (informationFile.empty()) { + cmSystemTools::Error( + cmStrCat("Could not find cmake module file: ", fpath)); + } else if (!mf->ReadListFile(informationFile)) { + cmSystemTools::Error(cmStrCat( + "Could not process cmake module file: ", informationFile)); + } } } |