summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-12-12 01:06:16 (GMT)
committerBrad King <brad.king@kitware.com>2024-01-04 16:59:26 (GMT)
commit2c6ec6de1521b1e82f2bd5ac3324f6953ac31f4d (patch)
tree1dbff1ddd17d156442894ebbb0bab50fa7db32d2 /Source/cmGeneratorTarget.cxx
parentdd4a6dff9246715b419a8daf4ced2d3c46a529df (diff)
downloadCMake-2c6ec6de1521b1e82f2bd5ac3324f6953ac31f4d.zip
CMake-2c6ec6de1521b1e82f2bd5ac3324f6953ac31f4d.tar.gz
CMake-2c6ec6de1521b1e82f2bd5ac3324f6953ac31f4d.tar.bz2
Link to transitive dependencies on stub libraries only on some linkers
Only linkers that enforce `--no-allow-shlib-undefined` recursively need to link private transitive dependencies on stub libraries explicitly.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 289bb24..11253db 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5596,6 +5596,20 @@ std::string cmGeneratorTarget::GetLinkerTool(const std::string& lang,
return linkerTool;
}
+bool cmGeneratorTarget::LinkerEnforcesNoAllowShLibUndefined(
+ std::string const& config) const
+{
+ // FIXME(#25486): Account for the LINKER_TYPE target property.
+ // Also factor out the hard-coded list below into a platform
+ // information table based on the linker id.
+ std::string ll = this->GetLinkerLanguage(config);
+ std::string linkerIdVar = cmStrCat("CMAKE_", ll, "_COMPILER_LINKER_ID");
+ cmValue linkerId = this->Makefile->GetDefinition(linkerIdVar);
+ // The GNU bfd-based linker may enforce '--no-allow-shlib-undefined'
+ // recursively by default. The Solaris linker has similar behavior.
+ return linkerId && (*linkerId == "GNU" || *linkerId == "Solaris");
+}
+
std::string cmGeneratorTarget::GetPDBOutputName(
const std::string& config) const
{