diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 4b7faa7be..e774e1658 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -555,7 +555,7 @@ void cmComputeLinkDepends::AddDirectLinkEntries() { // Add direct link dependencies in this configuration. cmLinkImplementation const* impl = - this->Target->Target->GetLinkImplementation(this->Config); + this->Target->GetLinkImplementation(this->Config); this->AddLinkEntries(-1, impl->Libraries); for(std::vector::const_iterator wi = impl->WrongConfigLibraries.begin(); diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 8ed4ddb30..9e37c3512 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -252,8 +252,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) } } - cmLinkImplementation const* impl = - depender->Target->GetLinkImplementation(*it); + cmLinkImplementation const* impl = depender->GetLinkImplementation(*it); // A target should not depend on itself. emitted.insert(depender->GetName()); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 057aa07a0..44fac1d02 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1336,7 +1336,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config, // Get languages built in this target. UNORDERED_SET languages; cmLinkImplementation const* impl = - this->Target->GetLinkImplementation(config); + this->GetLinkImplementation(config); assert(impl); for(std::vector::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) @@ -4058,7 +4058,7 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config, if (this->GetType() != cmTarget::INTERFACE_LIBRARY) { cmLinkImplementation const* impl = - this->Target->GetLinkImplementation(config); + this->GetLinkImplementation(config); for(std::vector::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { @@ -4099,7 +4099,7 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config, { // Targets using this archive need its language runtime libraries. if(cmLinkImplementation const* impl = - this->Target->GetLinkImplementation(config)) + this->GetLinkImplementation(config)) { iface.Languages = impl->Languages; } @@ -4389,3 +4389,28 @@ cmGeneratorTarget::GetHeadToLinkInterfaceUsageRequirementsMap( std::string CONFIG = cmSystemTools::UpperCase(config); return this->LinkInterfaceUsageRequirementsOnlyMap[CONFIG]; } + +//---------------------------------------------------------------------------- +const cmLinkImplementation * +cmGeneratorTarget::GetLinkImplementation(const std::string& config) const +{ + // There is no link implementation for imported targets. + if(this->Target->IsImported()) + { + return 0; + } + + cmOptionalLinkImplementation& impl = this->Target->GetLinkImplMap(config); + if(!impl.LibrariesDone) + { + impl.LibrariesDone = true; + this->Target->ComputeLinkImplementationLibraries(config, impl, + this->Target); + } + if(!impl.LanguagesDone) + { + impl.LanguagesDone = true; + this->Target->ComputeLinkImplementationLanguages(config, impl); + } + return &impl; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 557eb1782..58f5f6b15 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -198,6 +198,9 @@ public: LinkClosure const* GetLinkClosure(const std::string& config) const; void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const; + cmLinkImplementation const* + GetLinkImplementation(const std::string& config) const; + /** Full path with trailing slash to the top-level directory holding object files for this target. Includes the build time config name placeholder if needed for the generator. */ diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f78a8a194..68fd06bd0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1384,7 +1384,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) // If the language is compiled as a source trust Xcode to link with it. cmLinkImplementation const* impl = - cmtarget.GetLinkImplementation("NOCONFIG"); + gtgt->GetLinkImplementation("NOCONFIG"); for(std::vector::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2e37c086f..a8ea0b85c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3564,30 +3564,6 @@ void cmTargetInternals::AddInterfaceEntries( } } -//---------------------------------------------------------------------------- -const cmLinkImplementation * -cmTarget::GetLinkImplementation(const std::string& config) const -{ - // There is no link implementation for imported targets. - if(this->IsImported()) - { - return 0; - } - - cmOptionalLinkImplementation& impl = this->GetLinkImplMap(config); - if(!impl.LibrariesDone) - { - impl.LibrariesDone = true; - this->ComputeLinkImplementationLibraries(config, impl, this); - } - if(!impl.LanguagesDone) - { - impl.LanguagesDone = true; - this->ComputeLinkImplementationLanguages(config, impl); - } - return &impl; -} - cmOptionalLinkImplementation& cmTarget::GetLinkImplMap(std::string const& config) const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 6411d12ba..1d353abe5 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -231,9 +231,6 @@ public: void GetObjectLibrariesCMP0026(std::vector& objlibs) const; - cmLinkImplementation const* - GetLinkImplementation(const std::string& config) const; - cmLinkImplementationLibraries const* GetLinkImplementationLibraries(const std::string& config) const;