summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-06-06 13:08:17 +0200
committerStephen Kelly <steveire@gmail.com>2015-07-01 19:46:19 +0200
commitfaec4e611d08ea2f75d2127e3ca3f5e9a427465b (patch)
treeab775b2bf9a9a4517204b700e4add7e41ca726c3
parent7e3ac12df45fa42b590971accaf1db89b1a0ffb6 (diff)
downloadcmake-faec4e611d08ea2f75d2127e3ca3f5e9a427465b.tar.gz
cmComputeTargetDepends: Change API to use cmGeneratorTarget.
-rw-r--r--Source/cmComputeTargetDepends.cxx81
-rw-r--r--Source/cmComputeTargetDepends.h16
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx4
-rw-r--r--Source/cmGlobalGenerator.cxx29
-rw-r--r--Source/cmGlobalGenerator.h7
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx6
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx24
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h4
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx27
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmTargetDepend.h13
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
16 files changed, 132 insertions, 108 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 87b47b49f4..c4a03a08d0 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -147,12 +147,12 @@ bool cmComputeTargetDepends::Compute()
//----------------------------------------------------------------------------
void
-cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t,
+cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t,
cmTargetDependSet& deps)
{
// Lookup the index for this target. All targets should be known by
// this point.
- std::map<cmTarget const*, int>::const_iterator tii
+ std::map<cmGeneratorTarget const*, int>::const_iterator tii
= this->TargetIndex.find(t);
assert(tii != this->TargetIndex.end());
int i = tii->second;
@@ -161,7 +161,7 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t,
EdgeList const& nl = this->FinalGraph[i];
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
- cmTarget const* dep = this->Targets[*ni];
+ cmGeneratorTarget const* dep = this->Targets[*ni];
cmTargetDependSet::iterator di = deps.insert(dep).first;
di->SetType(ni->IsStrong());
}
@@ -180,9 +180,11 @@ void cmComputeTargetDepends::CollectTargets()
ti != targets.end(); ++ti)
{
cmTarget const* target = &ti->second;
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(target);
int index = static_cast<int>(this->Targets.size());
- this->TargetIndex[target] = index;
- this->Targets.push_back(target);
+ this->TargetIndex[gt] = index;
+ this->Targets.push_back(gt);
}
}
}
@@ -204,7 +206,7 @@ void cmComputeTargetDepends::CollectDepends()
void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
{
// Get the depender.
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
if (depender->GetType() == cmTarget::INTERFACE_LIBRARY)
{
return;
@@ -216,10 +218,9 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// deal with config-specific dependencies.
{
std::set<std::string> emitted;
- cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(depender);
std::vector<std::string> configs;
- depender->GetMakefile()->GetConfigurations(configs);
+ depender->Makefile->GetConfigurations(configs);
if (configs.empty())
{
configs.push_back("");
@@ -228,7 +229,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
it != configs.end(); ++it)
{
std::vector<cmSourceFile const*> objectFiles;
- gt->GetExternalObjects(objectFiles, *it);
+ depender->GetExternalObjects(objectFiles, *it);
for(std::vector<cmSourceFile const*>::const_iterator
oi = objectFiles.begin(); oi != objectFiles.end(); ++oi)
{
@@ -244,15 +245,15 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
->IssueMessage(cmake::FATAL_ERROR,
"Only executables and non-OBJECT libraries may "
"reference target objects.",
- depender->GetBacktrace());
+ depender->Target->GetBacktrace());
return;
}
- const_cast<cmTarget*>(depender)->AddUtility(objLib);
+ const_cast<cmGeneratorTarget*>(depender)->Target->AddUtility(objLib);
}
}
cmTarget::LinkImplementation const* impl =
- depender->GetLinkImplementation(*it);
+ depender->Target->GetLinkImplementation(*it);
// A target should not depend on itself.
emitted.insert(depender->GetName());
@@ -272,7 +273,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Loop over all utility dependencies.
{
- std::set<cmLinkItem> const& tutils = depender->GetUtilityItems();
+ std::set<cmLinkItem> const& tutils = depender->Target->GetUtilityItems();
std::set<std::string> emitted;
// A target should not depend on itself.
emitted.insert(depender->GetName());
@@ -290,13 +291,14 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
- cmTarget const* dependee,
- const std::string& config,
- std::set<std::string> &emitted)
+ const cmGeneratorTarget* dependee,
+ const std::string& config,
+ std::set<std::string> &emitted)
{
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
if(cmTarget::LinkInterface const* iface =
- dependee->GetLinkInterface(config, depender))
+ dependee->Target->GetLinkInterface(config,
+ depender->Target))
{
for(std::vector<cmLinkItem>::const_iterator
lib = iface->Libraries.begin();
@@ -317,7 +319,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
cmLinkItem const& dependee_name,
std::set<std::string> &emitted)
{
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
cmTarget const* dependee = dependee_name.Target;
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
@@ -331,16 +333,17 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
if(dependee)
{
- this->AddInterfaceDepends(depender_index, dependee, "", emitted);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(dependee);
+ this->AddInterfaceDepends(depender_index, gt, "", emitted);
std::vector<std::string> configs;
- depender->GetMakefile()->GetConfigurations(configs);
+ depender->Makefile->GetConfigurations(configs);
for (std::vector<std::string>::const_iterator it = configs.begin();
it != configs.end(); ++it)
{
// A target should not depend on itself.
emitted.insert(depender->GetName());
- this->AddInterfaceDepends(depender_index, dependee,
- *it, emitted);
+ this->AddInterfaceDepends(depender_index, gt, *it, emitted);
}
}
}
@@ -351,7 +354,7 @@ void cmComputeTargetDepends::AddTargetDepend(
bool linking)
{
// Get the depender.
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
// Check the target's makefile first.
cmTarget const* dependee = dependee_name.Target;
@@ -362,7 +365,7 @@ void cmComputeTargetDepends::AddTargetDepend(
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
bool issueMessage = false;
std::ostringstream e;
- switch(depender->GetPolicyStatusCMP0046())
+ switch(depender->Target->GetPolicyStatusCMP0046())
{
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n";
@@ -383,7 +386,7 @@ void cmComputeTargetDepends::AddTargetDepend(
<< "\" of target \"" << depender->GetName() << "\" does not exist.";
cmListFileBacktrace const* backtrace =
- depender->GetUtilityBacktrace(dependee_name);
+ depender->Target->GetUtilityBacktrace(dependee_name);
if(backtrace)
{
cm->IssueMessage(messageType, e.str(), *backtrace);
@@ -408,27 +411,31 @@ void cmComputeTargetDepends::AddTargetDepend(
if(dependee)
{
- this->AddTargetDepend(depender_index, dependee, linking);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(dependee);
+ this->AddTargetDepend(depender_index, gt, linking);
}
}
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddTargetDepend(int depender_index,
- cmTarget const* dependee,
+ const cmGeneratorTarget* dependee,
bool linking)
{
- if(dependee->IsImported() ||
+ if(dependee->Target->IsImported() ||
dependee->GetType() == cmTarget::INTERFACE_LIBRARY)
{
// Skip IMPORTED and INTERFACE targets but follow their utility
// dependencies.
- std::set<cmLinkItem> const& utils = dependee->GetUtilityItems();
+ std::set<cmLinkItem> const& utils = dependee->Target->GetUtilityItems();
for(std::set<cmLinkItem>::const_iterator i = utils.begin();
i != utils.end(); ++i)
{
if(cmTarget const* transitive_dependee = i->Target)
{
- this->AddTargetDepend(depender_index, transitive_dependee, false);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(transitive_dependee);
+ this->AddTargetDepend(depender_index, gt, false);
}
}
}
@@ -436,7 +443,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
{
// Lookup the index for this target. All targets should be known by
// this point.
- std::map<cmTarget const*, int>::const_iterator tii =
+ std::map<cmGeneratorTarget const*, int>::const_iterator tii =
this->TargetIndex.find(dependee);
assert(tii != this->TargetIndex.end());
int dependee_index = tii->second;
@@ -457,13 +464,13 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph,
for(int depender_index = 0; depender_index < n; ++depender_index)
{
EdgeList const& nl = graph[depender_index];
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
fprintf(stderr, "target %d is [%s]\n",
depender_index, depender->GetName().c_str());
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int dependee_index = *ni;
- cmTarget const* dependee = this->Targets[dependee_index];
+ cmGeneratorTarget const* dependee = this->Targets[dependee_index];
fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index,
dependee->GetName().c_str(), ni->IsStrong()? "strong" : "weak");
}
@@ -550,11 +557,11 @@ cmComputeTargetDepends
{
// Get the depender.
int i = *ci;
- cmTarget const* depender = this->Targets[i];
+ cmGeneratorTarget const* depender = this->Targets[i];
// Describe the depender.
e << " \"" << depender->GetName() << "\" of type "
- << cmTarget::GetTargetTypeName(depender->GetType()) << "\n";
+ << cmTarget::GetTargetTypeName(depender->Target->GetType()) << "\n";
// List its dependencies that are inside the component.
EdgeList const& nl = this->InitialGraph[i];
@@ -563,7 +570,7 @@ cmComputeTargetDepends
int j = *ni;
if(cmap[j] == c)
{
- cmTarget const* dependee = this->Targets[j];
+ cmGeneratorTarget const* dependee = this->Targets[j];
e << " depends on \"" << dependee->GetName() << "\""
<< " (" << (ni->IsStrong()? "strong" : "weak") << ")\n";
}
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index 902f342bf5..6100d970a9 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -21,7 +21,7 @@
class cmComputeComponentGraph;
class cmGlobalGenerator;
class cmLinkItem;
-class cmTarget;
+class cmGeneratorTarget;
class cmTargetDependSet;
/** \class cmComputeTargetDepends
@@ -39,9 +39,10 @@ public:
bool Compute();
- std::vector<cmTarget const*> const&
+ std::vector<cmGeneratorTarget const*> const&
GetTargets() const { return this->Targets; }
- void GetTargetDirectDepends(cmTarget const* t, cmTargetDependSet& deps);
+ void GetTargetDirectDepends(cmGeneratorTarget const* t,
+ cmTargetDependSet& deps);
private:
void CollectTargets();
void CollectDepends();
@@ -49,13 +50,14 @@ private:
void AddTargetDepend(int depender_index,
cmLinkItem const& dependee_name,
bool linking);
- void AddTargetDepend(int depender_index, cmTarget const* dependee,
+ void AddTargetDepend(int depender_index, cmGeneratorTarget const* dependee,
bool linking);
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
void AddInterfaceDepends(int depender_index,
cmLinkItem const& dependee_name,
std::set<std::string> &emitted);
- void AddInterfaceDepends(int depender_index, cmTarget const* dependee,
+ void AddInterfaceDepends(int depender_index,
+ cmGeneratorTarget const* dependee,
const std::string& config,
std::set<std::string> &emitted);
cmGlobalGenerator* GlobalGenerator;
@@ -63,8 +65,8 @@ private:
bool NoCycles;
// Collect all targets.
- std::vector<cmTarget const*> Targets;
- std::map<cmTarget const*, int> TargetIndex;
+ std::vector<cmGeneratorTarget const*> Targets;
+ std::map<cmGeneratorTarget const*, int> TargetIndex;
// Represent the target dependency graph. The entry at each
// top-level index corresponds to a depender whose dependencies are
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 14efc3e660..2f9265a911 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -355,11 +355,11 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
{
// library directories
cmTargetDependSet tds =
- this->GetGlobalGenerator()->GetTargetDirectDepends(*this->Target);
+ this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget);
for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end();
++tdsI)
{
- const cmTarget *tg(*tdsI);
+ const cmTarget *tg = (*tdsI)->Target;
*this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg)
<< "\"" << std::endl;
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 23ab93de8d..a69732e792 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1354,9 +1354,9 @@ bool cmGlobalGenerator::ComputeTargetDepends()
{
return false;
}
- std::vector<cmTarget const*> const& targets = ctd.GetTargets();
- for(std::vector<cmTarget const*>::const_iterator ti = targets.begin();
- ti != targets.end(); ++ti)
+ std::vector<cmGeneratorTarget const*> const& targets = ctd.GetTargets();
+ for(std::vector<cmGeneratorTarget const*>::const_iterator ti
+ = targets.begin(); ti != targets.end(); ++ti)
{
ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]);
}
@@ -2050,12 +2050,13 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
// Add dependencies of the included target. An excluded
// target may still be included if it is a dependency of a
// non-excluded target.
- TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator ti = tgtdeps.begin();
ti != tgtdeps.end(); ++ti)
{
- cmTarget const* ttt = *ti;
- targetSet.insert(ttt);
+ cmGeneratorTarget const* ttt = *ti;
+ targetSet.insert(ttt->Target);
}
}
}
@@ -2517,9 +2518,9 @@ void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&,
//----------------------------------------------------------------------------
cmGlobalGenerator::TargetDependSet const&
-cmGlobalGenerator::GetTargetDirectDepends(cmTarget const& target)
+cmGlobalGenerator::GetTargetDirectDepends(cmGeneratorTarget const* target)
{
- return this->TargetDependencies[&target];
+ return this->TargetDependencies[target];
}
void cmGlobalGenerator::AddTarget(cmTarget* t)
@@ -2619,9 +2620,10 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
continue;
}
// put the target in the set of original targets
- originalTargets.insert(target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
+ originalTargets.insert(gt);
// Get the set of targets that depend on target
- this->AddTargetDepends(target, projectTargets);
+ this->AddTargetDepends(gt, projectTargets);
}
}
}
@@ -2634,7 +2636,7 @@ bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) const
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::AddTargetDepends(cmTarget const* target,
+void cmGlobalGenerator::AddTargetDepends(cmGeneratorTarget const* target,
TargetDependSet& projectTargets)
{
// add the target itself
@@ -2642,11 +2644,10 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget const* target,
{
// This is the first time we have encountered the target.
// Recursively follow its dependencies.
- TargetDependSet const& ts = this->GetTargetDirectDepends(*target);
+ TargetDependSet const& ts = this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator i = ts.begin(); i != ts.end(); ++i)
{
- cmTarget const* dtarget = *i;
- this->AddTargetDepends(dtarget, projectTargets);
+ this->AddTargetDepends(*i, projectTargets);
}
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index d606cc939d..f86e825534 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -292,7 +292,8 @@ public:
// what targets does the specified target depend on directly
// via a target_link_libraries or add_dependencies
- TargetDependSet const& GetTargetDirectDepends(cmTarget const& target);
+ TargetDependSet const& GetTargetDirectDepends(
+ const cmGeneratorTarget* target);
/** Get per-target generator information. */
cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const;
@@ -368,7 +369,7 @@ protected:
TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const&);
bool IsRootOnlyTarget(cmTarget* target) const;
- void AddTargetDepends(cmTarget const* target,
+ void AddTargetDepends(const cmGeneratorTarget* target,
TargetDependSet& projectTargets);
void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf);
void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf);
@@ -477,7 +478,7 @@ private:
std::vector<std::string> FilesReplacedDuringGenerate;
// Store computed inter-target dependencies.
- typedef std::map<cmTarget const*, TargetDependSet> TargetDependMap;
+ typedef std::map<cmGeneratorTarget const*, TargetDependSet> TargetDependMap;
TargetDependMap TargetDependencies;
// Per-target generator information.
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 103d75ab13..722294b75e 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -949,8 +949,8 @@ cmGlobalNinjaGenerator
std::set<std::string> const& utils = target->GetUtilities();
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
} else {
- cmTargetDependSet const& targetDeps =
- this->GetTargetDirectDepends(*target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
+ cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(gt);
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
i != targetDeps.end(); ++i)
{
@@ -958,7 +958,7 @@ cmGlobalNinjaGenerator
{
continue;
}
- this->AppendTargetOutputs(*i, outputs);
+ this->AppendTargetOutputs((*i)->Target, outputs);
}
}
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 0f61225f5d..412728f38e 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -804,7 +804,7 @@ cmGlobalUnixMakefileGenerator3
lg->AppendEcho(commands, "Built target " + name,
cmLocalUnixMakefileGenerator3::EchoNormal, &progress);
- this->AppendGlobalTargetDepends(depends,*gtarget->Target);
+ this->AppendGlobalTargetDepends(depends, gtarget);
lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
localName, depends, commands, true);
@@ -832,7 +832,7 @@ cmGlobalUnixMakefileGenerator3
//
std::set<cmTarget const*> emitted;
progCmd << " "
- << this->CountProgressMarksInTarget(gtarget->Target, emitted);
+ << this->CountProgressMarksInTarget(gtarget, emitted);
commands.push_back(progCmd.str());
}
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
@@ -908,14 +908,14 @@ cmGlobalUnixMakefileGenerator3
//----------------------------------------------------------------------------
size_t
cmGlobalUnixMakefileGenerator3
-::CountProgressMarksInTarget(cmTarget const* target,
+::CountProgressMarksInTarget(cmGeneratorTarget const* target,
std::set<cmTarget const*>& emitted)
{
size_t count = 0;
- if(emitted.insert(target).second)
+ if(emitted.insert(target->Target).second)
{
- count = this->ProgressMap[target].Marks.size();
- TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ count = this->ProgressMap[target->Target].Marks.size();
+ TargetDependSet const& depends = this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
@@ -941,7 +941,8 @@ cmGlobalUnixMakefileGenerator3
for(std::set<cmTarget const*>::const_iterator t = targets.begin();
t != targets.end(); ++t)
{
- count += this->CountProgressMarksInTarget(*t, emitted);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(*t);
+ count += this->CountProgressMarksInTarget(gt, emitted);
}
return count;
}
@@ -987,22 +988,21 @@ cmGlobalUnixMakefileGenerator3::TargetProgress
void
cmGlobalUnixMakefileGenerator3
::AppendGlobalTargetDepends(std::vector<std::string>& depends,
- cmTarget& target)
+ cmGeneratorTarget* target)
{
TargetDependSet const& depends_set = this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator i = depends_set.begin();
i != depends_set.end(); ++i)
{
// Create the target-level dependency.
- cmTarget const* dep = *i;
+ cmGeneratorTarget const* dep = *i;
if (dep->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
}
cmLocalUnixMakefileGenerator3* lg3 =
- static_cast<cmLocalUnixMakefileGenerator3*>
- (dep->GetMakefile()->GetLocalGenerator());
- std::string tgtName = lg3->GetRelativeTargetDirectory(*dep);
+ static_cast<cmLocalUnixMakefileGenerator3*>(dep->GetLocalGenerator());
+ std::string tgtName = lg3->GetRelativeTargetDirectory(*(*dep).Target);
tgtName += "/all";
depends.push_back(tgtName);
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index a639ff0fd5..8805011df4 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -153,7 +153,7 @@ protected:
cmLocalUnixMakefileGenerator3* lg);
void AppendGlobalTargetDepends(std::vector<std::string>& depends,
- cmTarget& target);
+ cmGeneratorTarget* target);
// does this generator need a requires step for any of its targets
bool NeedRequiresStep(cmTarget const&);
@@ -198,7 +198,7 @@ protected:
cmStrictTargetComparison> ProgressMapType;
ProgressMapType ProgressMap;
- size_t CountProgressMarksInTarget(cmTarget const* target,
+ size_t CountProgressMarksInTarget(cmGeneratorTarget const* target,
std::set<cmTarget const*>& emitted);
size_t CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg);
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 632141af93..65a15eef10 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -224,7 +224,7 @@ void cmGlobalVisualStudio6Generator
tt = orderedProjectTargets.begin();
tt != orderedProjectTargets.end(); ++tt)
{
- cmTarget const* target = *tt;
+ cmTarget const* target = (*tt)->Target;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index f453da1984..1674e98186 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -402,7 +402,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget const* target = *tt;
+ cmTarget const* target = (*tt)->Target;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -442,7 +442,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget const* target = *tt;
+ cmTarget const* target = (*tt)->Target;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -534,7 +534,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget const* target = *tt;
+ cmTarget const* target = (*tt)->Target;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -1045,12 +1045,12 @@ cmGlobalVisualStudio7Generator
::IsDependedOn(OrderedTargetDependSet const& projectTargets,
cmTarget const* targetIn)
{
+ cmGeneratorTarget* gtIn = this->GetGeneratorTarget(targetIn);
for (OrderedTargetDependSet::const_iterator l = projectTargets.begin();
l != projectTargets.end(); ++l)
{
- cmTarget const& target = **l;
- TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
- if(tgtdeps.count(targetIn))
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(*l);
+ if(tgtdeps.count(gtIn))
{
return true;
}
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index b96a799ab6..f3cf36e5f0 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -441,7 +441,8 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
std::ostream& fout, const std::string&, const char*, cmTarget const& t)
{
- TargetDependSet const& unordered = this->GetTargetDirectDepends(t);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&t);
+ TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
OrderedTargetDependSet depends(unordered);
for(OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 585d19a816..438d60eca9 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -299,13 +299,14 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target,
{
if(linked.insert(target).second)
{
- TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
+ TargetDependSet const& depends = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
if(di->IsLink())
{
- this->FillLinkClosure(*di, linked);
+ this->FillLinkClosure((*di)->Target, linked);
}
}
}
@@ -338,13 +339,14 @@ void cmGlobalVisualStudioGenerator::FollowLinkDepends(
{
// Static library targets do not list their link dependencies so
// we must follow them transitively now.
- TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
+ TargetDependSet const& depends = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
if(di->IsLink())
{
- this->FollowLinkDepends(*di, linked);
+ this->FollowLinkDepends((*di)->Target, linked);
}
}
}
@@ -413,7 +415,8 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
target.GetType() != cmTarget::MODULE_LIBRARY &&
target.GetType() != cmTarget::EXECUTABLE);
- TargetDependSet const& depends = this->GetTargetDirectDepends(target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+ TargetDependSet const& depends = this->GetTargetDirectDepends(gt);
// Collect implicit link dependencies (target_link_libraries).
// Static libraries cannot depend on their link implementation
@@ -427,7 +430,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
cmTargetDepend dep = *di;
if(dep.IsLink())
{
- this->FollowLinkDepends(dep, linkDepends);
+ this->FollowLinkDepends(dep->Target, linkDepends);
}
}
}
@@ -440,7 +443,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
cmTargetDepend dep = *di;
if(dep.IsUtil())
{
- this->FollowLinkDepends(dep, utilDepends);
+ this->FollowLinkDepends(dep->Target, utilDepends);
}
}
@@ -843,7 +846,7 @@ cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target)
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudioGenerator::TargetCompare
-::operator()(cmTarget const* l, cmTarget const* r) const
+::operator()(cmGeneratorTarget const* l, cmGeneratorTarget const* r) const
{
// Make sure ALL_BUILD is first so it is the default active project.
if(r->GetName() == "ALL_BUILD")
@@ -868,7 +871,13 @@ cmGlobalVisualStudioGenerator::OrderedTargetDependSet
cmGlobalVisualStudioGenerator::OrderedTargetDependSet
::OrderedTargetDependSet(TargetSet const& targets)
{
- this->insert(targets.begin(), targets.end());
+ for (TargetSet::const_iterator it = targets.begin();
+ it != targets.end(); ++it)
+ {
+ cmGeneratorTarget* gt =
+ (*it)->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(*it);
+ this->insert(gt);
+ }
}
std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir(
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 69b4564c5e..41843b314a 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -91,7 +91,8 @@ public:
class TargetSet: public std::set<cmTarget const*> {};
struct TargetCompare
{
- bool operator()(cmTarget const* l, cmTarget const* r) const;
+ bool operator()(cmGeneratorTarget const* l,
+ cmGeneratorTarget const* r) const;
};
class OrderedTargetDependSet;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 1301e3ebb4..505929ea79 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2895,10 +2895,11 @@ void cmGlobalXCodeGenerator
}
// Add dependencies on other CMake targets.
- TargetDependSet const& deps = this->GetTargetDirectDepends(*cmtarget);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(cmtarget);
+ TargetDependSet const& deps = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator i = deps.begin(); i != deps.end(); ++i)
{
- if(cmXCodeObject* dptarget = this->FindXCodeTarget(*i))
+ if(cmXCodeObject* dptarget = this->FindXCodeTarget((*i)->Target))
{
this->AddDependTarget(target, dptarget);
}
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index 1feb07203e..c5059ee2b9 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -14,23 +14,24 @@
#include "cmStandardIncludes.h"
-class cmTarget;
+class cmGeneratorTarget;
/** One edge in the global target dependency graph.
It may be marked as a 'link' or 'util' edge or both. */
class cmTargetDepend
{
- cmTarget const* Target;
+ cmGeneratorTarget const* Target;
// The set order depends only on the Target, so we use
// mutable members to acheive a map with set syntax.
mutable bool Link;
mutable bool Util;
public:
- cmTargetDepend(cmTarget const* t): Target(t), Link(false), Util(false) {}
- operator cmTarget const*() const { return this->Target; }
- cmTarget const* operator->() const { return this->Target; }
- cmTarget const& operator*() const { return *this->Target; }
+ cmTargetDepend(cmGeneratorTarget const* t)
+ : Target(t), Link(false), Util(false) {}
+ operator cmGeneratorTarget const*() const { return this->Target; }
+ cmGeneratorTarget const* operator->() const { return this->Target; }
+ cmGeneratorTarget const& operator*() const { return *this->Target; }
friend bool operator < (cmTargetDepend const& l, cmTargetDepend const& r)
{ return l.Target < r.Target; }
void SetType(bool strong) const
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 12a1e42c0d..591c2db539 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2660,7 +2660,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
void cmVisualStudio10TargetGenerator::WriteProjectReferences()
{
cmGlobalGenerator::TargetDependSet const& unordered
- = this->GlobalGenerator->GetTargetDirectDepends(*this->Target);
+ = this->GlobalGenerator->GetTargetDirectDepends(this->GeneratorTarget);
typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet
OrderedTargetDependSet;
OrderedTargetDependSet depends(unordered);
@@ -2668,7 +2668,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
for( OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
{
- cmTarget const* dt = *i;
+ cmTarget const* dt = (*i)->Target;
if(dt->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;