diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2023-04-19 14:01:10 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2023-05-03 15:08:07 (GMT) |
commit | 375e6fdbbe398921de321216125765ba1917a325 (patch) | |
tree | 43d934f18f4d28a82d5264a0d0fb0301bc0bf7d9 /Source/cmGeneratorTarget.cxx | |
parent | 24a3e5cda049138ca178216e0d7b02262e4035ed (diff) | |
download | CMake-375e6fdbbe398921de321216125765ba1917a325.zip CMake-375e6fdbbe398921de321216125765ba1917a325.tar.gz CMake-375e6fdbbe398921de321216125765ba1917a325.tar.bz2 |
Link step: use linker dependency linker file
Based on work done by @ben.boeckel (!8051)
Fixes: #22217
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1c37e52..8ac19fc 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8518,6 +8518,30 @@ bool cmGeneratorTarget::IsLinkable() const this->IsExecutableWithExports()); } +bool cmGeneratorTarget::HasLinkDependencyFile(std::string const& config) const +{ + if (this->GetType() != cmStateEnums::EXECUTABLE && + this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY) { + return false; + } + + if (this->Target->GetProperty("LINK_DEPENDS_NO_SHARED").IsOn()) { + // Do not use the linker dependency file because it includes shared + // libraries as well + return false; + } + + const std::string depsUseLinker{ "CMAKE_LINK_DEPENDS_USE_LINKER" }; + auto linkLanguage = this->GetLinkerLanguage(config); + const std::string langDepsUseLinker{ cmStrCat("CMAKE_", linkLanguage, + "_LINK_DEPENDS_USE_LINKER") }; + + return (!this->Makefile->IsDefinitionSet(depsUseLinker) || + this->Makefile->IsOn(depsUseLinker)) && + this->Makefile->IsOn(langDepsUseLinker); +} + bool cmGeneratorTarget::IsFrameworkOnApple() const { return this->Target->IsFrameworkOnApple(); |