From 9ca4cae51e8fb67e628fe7b41eea3f459f148237 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 8 Oct 2015 01:01:38 +0200 Subject: cmGeneratorTarget: Move GetUtilityItems from cmTarget. --- Source/cmComputeLinkDepends.h | 1 + Source/cmComputeTargetDepends.cxx | 4 ++-- Source/cmGeneratorTarget.cxx | 21 +++++++++++++++++++-- Source/cmGeneratorTarget.h | 4 ++++ Source/cmTarget.cxx | 21 --------------------- Source/cmTarget.h | 2 -- 6 files changed, 26 insertions(+), 27 deletions(-) diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index cd067f5..33ba0b8 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -14,6 +14,7 @@ #include "cmStandardIncludes.h" #include "cmTarget.h" +#include "cmLinkItem.h" #include "cmGraphAdjacencyList.h" diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 18aad10..e53b7b9 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -272,7 +272,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Loop over all utility dependencies. { - std::set const& tutils = depender->Target->GetUtilityItems(); + std::set const& tutils = depender->GetUtilityItems(); std::set emitted; // A target should not depend on itself. emitted.insert(depender->GetName()); @@ -426,7 +426,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, { // Skip IMPORTED and INTERFACE targets but follow their utility // dependencies. - std::set const& utils = dependee->Target->GetUtilityItems(); + std::set const& utils = dependee->GetUtilityItems(); for(std::set::const_iterator i = utils.begin(); i != utils.end(); ++i) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 96bacdf..d56559a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -271,7 +271,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) DebugCompileFeaturesDone(false), DebugCompileDefinitionsDone(false), DebugSourcesDone(false), - LinkImplementationLanguageIsContextDependent(true) + LinkImplementationLanguageIsContextDependent(true), + UtilityItemsDone(false) { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = lg; @@ -760,7 +761,23 @@ cmGeneratorTarget::GetExpectedXamlSources(std::set& srcs, { XamlData data; IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) - srcs = data.ExpectedXamlSources; + srcs = data.ExpectedXamlSources; +} + +std::set const& cmGeneratorTarget::GetUtilityItems() const +{ + if(!this->UtilityItemsDone) + { + this->UtilityItemsDone = true; + std::set const& utilities = this->Target->GetUtilities(); + for(std::set::const_iterator i = utilities.begin(); + i != utilities.end(); ++i) + { + this->UtilityItems.insert( + cmLinkItem(*i, this->Makefile->FindTargetToUse(*i))); + } + } + return this->UtilityItems; } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 799110c..70612f2 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -82,6 +82,8 @@ public: void GetExpectedXamlSources(std::set&, const std::string& config) const; + std::setconst& GetUtilityItems() const; + void ComputeObjectMapping(); const char* GetFeature(const std::string& feature, @@ -537,6 +539,7 @@ private: typedef std::pair OutputNameKey; typedef std::map OutputNameMapType; mutable OutputNameMapType OutputNameMap; + mutable std::set UtilityItems; mutable bool PolicyWarnedCMP0022; mutable bool DebugIncludesDone; mutable bool DebugCompileOptionsDone; @@ -544,6 +547,7 @@ private: mutable bool DebugCompileDefinitionsDone; mutable bool DebugSourcesDone; mutable bool LinkImplementationLanguageIsContextDependent; + mutable bool UtilityItemsDone; bool ComputePDBOutputDir(const std::string& kind, const std::string& config, std::string& out) const; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3de7efe..31a9aa7 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -67,12 +67,10 @@ public: cmTargetInternals() : Backtrace() { - this->UtilityItemsDone = false; } cmTargetInternals(cmTargetInternals const&) : Backtrace() { - this->UtilityItemsDone = false; } ~cmTargetInternals(); @@ -82,9 +80,6 @@ public: typedef std::map ImportInfoMapType; ImportInfoMapType ImportInfoMap; - std::set UtilityItems; - bool UtilityItemsDone; - std::vector IncludeDirectoriesEntries; std::vector IncludeDirectoriesBacktraces; std::vector CompileOptionsEntries; @@ -364,22 +359,6 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace( } //---------------------------------------------------------------------------- -std::set const& cmTarget::GetUtilityItems() const -{ - if(!this->Internal->UtilityItemsDone) - { - this->Internal->UtilityItemsDone = true; - for(std::set::const_iterator i = this->Utilities.begin(); - i != this->Utilities.end(); ++i) - { - this->Internal->UtilityItems.insert( - cmLinkItem(*i, this->Makefile->FindTargetToUse(*i))); - } - } - return this->Internal->UtilityItems; -} - -//---------------------------------------------------------------------------- void cmTarget::FinishConfigure() { // Erase any cached link information that might have been comptued diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 16d0121..0c1bbd2 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -16,7 +16,6 @@ #include "cmPropertyMap.h" #include "cmPolicies.h" #include "cmListFileCache.h" -#include "cmLinkItem.h" #include #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -206,7 +205,6 @@ public: void AddUtility(const std::string& u, cmMakefile *makefile = 0); ///! Get the utilities used by this target std::setconst& GetUtilities() const { return this->Utilities; } - std::setconst& GetUtilityItems() const; cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; /** Finalize the target at the end of the Configure step. */ -- cgit v0.12