cmGeneratorTarget: Move GetUtilityItems from cmTarget.

This commit is contained in:
Stephen Kelly 2015-10-08 01:01:38 +02:00
parent d6b394edcb
commit 9ca4cae51e
6 changed files with 26 additions and 27 deletions

View File

@ -14,6 +14,7 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmTarget.h" #include "cmTarget.h"
#include "cmLinkItem.h"
#include "cmGraphAdjacencyList.h" #include "cmGraphAdjacencyList.h"

View File

@ -272,7 +272,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Loop over all utility dependencies. // Loop over all utility dependencies.
{ {
std::set<cmLinkItem> const& tutils = depender->Target->GetUtilityItems(); std::set<cmLinkItem> const& tutils = depender->GetUtilityItems();
std::set<std::string> emitted; std::set<std::string> emitted;
// A target should not depend on itself. // A target should not depend on itself.
emitted.insert(depender->GetName()); emitted.insert(depender->GetName());
@ -426,7 +426,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
{ {
// Skip IMPORTED and INTERFACE targets but follow their utility // Skip IMPORTED and INTERFACE targets but follow their utility
// dependencies. // dependencies.
std::set<cmLinkItem> const& utils = dependee->Target->GetUtilityItems(); std::set<cmLinkItem> const& utils = dependee->GetUtilityItems();
for(std::set<cmLinkItem>::const_iterator i = utils.begin(); for(std::set<cmLinkItem>::const_iterator i = utils.begin();
i != utils.end(); ++i) i != utils.end(); ++i)
{ {

View File

@ -271,7 +271,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
DebugCompileFeaturesDone(false), DebugCompileFeaturesDone(false),
DebugCompileDefinitionsDone(false), DebugCompileDefinitionsDone(false),
DebugSourcesDone(false), DebugSourcesDone(false),
LinkImplementationLanguageIsContextDependent(true) LinkImplementationLanguageIsContextDependent(true),
UtilityItemsDone(false)
{ {
this->Makefile = this->Target->GetMakefile(); this->Makefile = this->Target->GetMakefile();
this->LocalGenerator = lg; this->LocalGenerator = lg;
@ -763,6 +764,22 @@ cmGeneratorTarget::GetExpectedXamlSources(std::set<std::string>& srcs,
srcs = data.ExpectedXamlSources; srcs = data.ExpectedXamlSources;
} }
std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const
{
if(!this->UtilityItemsDone)
{
this->UtilityItemsDone = true;
std::set<std::string> const& utilities = this->Target->GetUtilities();
for(std::set<std::string>::const_iterator i = utilities.begin();
i != utilities.end(); ++i)
{
this->UtilityItems.insert(
cmLinkItem(*i, this->Makefile->FindTargetToUse(*i)));
}
}
return this->UtilityItems;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGeneratorTarget void cmGeneratorTarget
::GetXamlSources(std::vector<cmSourceFile const*>& srcs, ::GetXamlSources(std::vector<cmSourceFile const*>& srcs,

View File

@ -82,6 +82,8 @@ public:
void GetExpectedXamlSources(std::set<std::string>&, void GetExpectedXamlSources(std::set<std::string>&,
const std::string& config) const; const std::string& config) const;
std::set<cmLinkItem>const& GetUtilityItems() const;
void ComputeObjectMapping(); void ComputeObjectMapping();
const char* GetFeature(const std::string& feature, const char* GetFeature(const std::string& feature,
@ -537,6 +539,7 @@ private:
typedef std::pair<std::string, bool> OutputNameKey; typedef std::pair<std::string, bool> OutputNameKey;
typedef std::map<OutputNameKey, std::string> OutputNameMapType; typedef std::map<OutputNameKey, std::string> OutputNameMapType;
mutable OutputNameMapType OutputNameMap; mutable OutputNameMapType OutputNameMap;
mutable std::set<cmLinkItem> UtilityItems;
mutable bool PolicyWarnedCMP0022; mutable bool PolicyWarnedCMP0022;
mutable bool DebugIncludesDone; mutable bool DebugIncludesDone;
mutable bool DebugCompileOptionsDone; mutable bool DebugCompileOptionsDone;
@ -544,6 +547,7 @@ private:
mutable bool DebugCompileDefinitionsDone; mutable bool DebugCompileDefinitionsDone;
mutable bool DebugSourcesDone; mutable bool DebugSourcesDone;
mutable bool LinkImplementationLanguageIsContextDependent; mutable bool LinkImplementationLanguageIsContextDependent;
mutable bool UtilityItemsDone;
bool ComputePDBOutputDir(const std::string& kind, const std::string& config, bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
std::string& out) const; std::string& out) const;

View File

@ -67,12 +67,10 @@ public:
cmTargetInternals() cmTargetInternals()
: Backtrace() : Backtrace()
{ {
this->UtilityItemsDone = false;
} }
cmTargetInternals(cmTargetInternals const&) cmTargetInternals(cmTargetInternals const&)
: Backtrace() : Backtrace()
{ {
this->UtilityItemsDone = false;
} }
~cmTargetInternals(); ~cmTargetInternals();
@ -82,9 +80,6 @@ public:
typedef std::map<std::string, cmTarget::ImportInfo> ImportInfoMapType; typedef std::map<std::string, cmTarget::ImportInfo> ImportInfoMapType;
ImportInfoMapType ImportInfoMap; ImportInfoMapType ImportInfoMap;
std::set<cmLinkItem> UtilityItems;
bool UtilityItemsDone;
std::vector<std::string> IncludeDirectoriesEntries; std::vector<std::string> IncludeDirectoriesEntries;
std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces; std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces;
std::vector<std::string> CompileOptionsEntries; std::vector<std::string> CompileOptionsEntries;
@ -363,22 +358,6 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(
return &i->second; return &i->second;
} }
//----------------------------------------------------------------------------
std::set<cmLinkItem> const& cmTarget::GetUtilityItems() const
{
if(!this->Internal->UtilityItemsDone)
{
this->Internal->UtilityItemsDone = true;
for(std::set<std::string>::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() void cmTarget::FinishConfigure()
{ {

View File

@ -16,7 +16,6 @@
#include "cmPropertyMap.h" #include "cmPropertyMap.h"
#include "cmPolicies.h" #include "cmPolicies.h"
#include "cmListFileCache.h" #include "cmListFileCache.h"
#include "cmLinkItem.h"
#include <cmsys/auto_ptr.hxx> #include <cmsys/auto_ptr.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
@ -206,7 +205,6 @@ public:
void AddUtility(const std::string& u, cmMakefile *makefile = 0); void AddUtility(const std::string& u, cmMakefile *makefile = 0);
///! Get the utilities used by this target ///! Get the utilities used by this target
std::set<std::string>const& GetUtilities() const { return this->Utilities; } std::set<std::string>const& GetUtilities() const { return this->Utilities; }
std::set<cmLinkItem>const& GetUtilityItems() const;
cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
/** Finalize the target at the end of the Configure step. */ /** Finalize the target at the end of the Configure step. */