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 "cmTarget.h"
#include "cmLinkItem.h"
#include "cmGraphAdjacencyList.h"

View File

@ -272,7 +272,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// 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;
// 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<cmLinkItem> const& utils = dependee->Target->GetUtilityItems();
std::set<cmLinkItem> const& utils = dependee->GetUtilityItems();
for(std::set<cmLinkItem>::const_iterator i = utils.begin();
i != utils.end(); ++i)
{

View File

@ -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<std::string>& srcs,
{
XamlData data;
IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData)
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;
}
//----------------------------------------------------------------------------

View File

@ -82,6 +82,8 @@ public:
void GetExpectedXamlSources(std::set<std::string>&,
const std::string& config) const;
std::set<cmLinkItem>const& GetUtilityItems() const;
void ComputeObjectMapping();
const char* GetFeature(const std::string& feature,
@ -537,6 +539,7 @@ private:
typedef std::pair<std::string, bool> OutputNameKey;
typedef std::map<OutputNameKey, std::string> OutputNameMapType;
mutable OutputNameMapType OutputNameMap;
mutable std::set<cmLinkItem> 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;

View File

@ -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<std::string, cmTarget::ImportInfo> ImportInfoMapType;
ImportInfoMapType ImportInfoMap;
std::set<cmLinkItem> UtilityItems;
bool UtilityItemsDone;
std::vector<std::string> IncludeDirectoriesEntries;
std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces;
std::vector<std::string> CompileOptionsEntries;
@ -363,22 +358,6 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(
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()
{

View File

@ -16,7 +16,6 @@
#include "cmPropertyMap.h"
#include "cmPolicies.h"
#include "cmListFileCache.h"
#include "cmLinkItem.h"
#include <cmsys/auto_ptr.hxx>
#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::set<std::string>const& GetUtilities() const { return this->Utilities; }
std::set<cmLinkItem>const& GetUtilityItems() const;
cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
/** Finalize the target at the end of the Configure step. */