From 848c8ccf18e325e0d2833ac468f733261832feca Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 30 Jun 2014 10:38:59 -0400 Subject: cmTarget: Refactor LinkImplementation to allow more information Create a cmLinkImplItem class derived from cmLinkItem so more information can be added to link implementation entries than link interface entries. Convert the LinkImplementation Libraries member to hold it. Update client sites accordingly. --- Source/cmComputeTargetDepends.cxx | 2 +- Source/cmGeneratorExpressionEvaluator.cxx | 4 ++-- Source/cmGeneratorTarget.cxx | 4 ++-- Source/cmTarget.cxx | 19 +++++++++++-------- Source/cmTarget.h | 12 +++++++++++- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 3929af4..75d3967 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -255,7 +255,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // A target should not depend on itself. emitted.insert(depender->GetName()); - for(std::vector::const_iterator + for(std::vector::const_iterator lib = impl->Libraries.begin(); lib != impl->Libraries.end(); ++lib) { diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index cf112ec..13eac3b 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -844,7 +844,7 @@ getLinkedTargetsContent( std::string getLinkedTargetsContent( - std::vector const &libraries, + std::vector const &libraries, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, @@ -852,7 +852,7 @@ getLinkedTargetsContent( const std::string &interfacePropertyName) { std::vector tgts; - for (std::vector::const_iterator + for (std::vector::const_iterator it = libraries.begin(); it != libraries.end(); ++it) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index fd82d17..eccb06a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -475,8 +475,8 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, } std::set uniqueDeps; - for(std::vector::const_iterator li = impl->Libraries.begin(); - li != impl->Libraries.end(); ++li) + for(std::vector::const_iterator + li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { cmTarget const* tgt = li->Target; if (!tgt) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d27293a..94b339b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2281,7 +2281,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const if(this->Makefile->IsOn("APPLE")) { LinkImplementation const* impl = this->GetLinkImplementation(config); - for(std::vector::const_iterator + for(std::vector::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { @@ -3675,7 +3675,8 @@ void cmTarget::ComputeLinkClosure(const std::string& config, // Add interface languages from linked targets. cmTargetCollectLinkLanguages cll(this, config, languages, this); - for(std::vector::const_iterator li = impl->Libraries.begin(); + for(std::vector::const_iterator + li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { cll.Visit(*li); @@ -6242,7 +6243,8 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const cmTarget::LinkImplementation const* impl = this->GetLinkImplementationLibraries(config); - for(std::vector::const_iterator it = impl->Libraries.begin(); + for(std::vector::const_iterator + it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { processILibs(config, this, *it, tgts , emitted); @@ -6383,7 +6385,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, // The link implementation is the default link interface. LinkImplementation const* impl = this->GetLinkImplementationLibrariesInternal(config, headTarget); - iface.Libraries = impl->Libraries; + std::copy(impl->Libraries.begin(), impl->Libraries.end(), + std::back_inserter(iface.Libraries)); if(this->PolicyStatusCMP0022 == cmPolicies::WARN && !this->Internal->PolicyWarnedCMP0022 && !usage_requirements_only) { @@ -6397,12 +6400,12 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, headTarget, usage_requirements_only, ifaceLibs); } - if (ifaceLibs != impl->Libraries) + if (ifaceLibs != iface.Libraries) { std::string oldLibraries; std::string newLibraries; const char *sep = ""; - for(std::vector::const_iterator it + for(std::vector::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { oldLibraries += sep; @@ -6470,7 +6473,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { cmTarget::LinkImplementation const* impl = thisTarget->GetLinkImplementation(config); - for(std::vector::const_iterator + for(std::vector::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { if(emitted.insert(*li).second) @@ -6674,7 +6677,7 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, // The entry is meant for this configuration. impl.Libraries.push_back( - cmLinkItem(name, this->FindTargetToLink(name))); + cmLinkImplItem(name, this->FindTargetToLink(name))); } std::set const& seenProps = cge->GetSeenTargetProperties(); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9d1f966..8578c51 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -54,6 +54,16 @@ public: cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {} cmTarget const* Target; }; +class cmLinkImplItem: public cmLinkItem +{ +public: + cmLinkImplItem(): cmLinkItem() {} + cmLinkImplItem(std::string const& n, + cmTarget const* t): + cmLinkItem(n, t) {} + cmLinkImplItem(cmLinkImplItem const& r): + cmLinkItem(r) {} +}; struct cmTargetLinkInformationMap: public std::map @@ -296,7 +306,7 @@ public: std::vector Languages; // Libraries linked directly in this configuration. - std::vector Libraries; + std::vector Libraries; // Libraries linked directly in other configurations. // Needed only for OLD behavior of CMP0003. -- cgit v0.12