Merge topic 'use-generator-target'

d4a8a554 cmGlobalGenerator: Map local generators to generator targets.
faec4e61 cmComputeTargetDepends: Change API to use cmGeneratorTarget.
This commit is contained in:
Brad King 2015-07-02 09:06:17 -04:00 committed by CMake Topic Stage
commit ef97d4429f
16 changed files with 137 additions and 115 deletions

View File

@ -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";
}

View File

@ -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

View File

@ -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;
}

View File

@ -1355,9 +1355,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]);
}
@ -2044,19 +2044,19 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
clg = clg->GetParent())
{
// This local generator includes the target.
std::set<cmTarget const*>& targetSet =
std::set<cmGeneratorTarget const*>& targetSet =
this->LocalGeneratorToTargetMap[clg];
targetSet.insert(&target);
cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
targetSet.insert(gt);
// 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);
TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator ti = tgtdeps.begin();
ti != tgtdeps.end(); ++ti)
{
cmTarget const* ttt = *ti;
targetSet.insert(ttt);
targetSet.insert(*ti);
}
}
}
@ -2518,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)
@ -2620,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);
}
}
}
@ -2635,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
@ -2643,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);
}
}
}

View File

@ -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);
@ -405,7 +406,7 @@ protected:
cmMakefile* CurrentMakefile;
// map from project name to vector of local generators in that project
std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap;
std::map<cmLocalGenerator*, std::set<cmTarget const*> >
std::map<cmLocalGenerator*, std::set<cmGeneratorTarget const*> >
LocalGeneratorToTargetMap;
// Set of named installation components requested by the project.
@ -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.

View File

@ -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);
}
}
}

View File

@ -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);
@ -830,9 +830,9 @@ cmGlobalUnixMakefileGenerator3
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
//
std::set<cmTarget const*> emitted;
std::set<cmGeneratorTarget 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,
std::set<cmTarget const*>& emitted)
::CountProgressMarksInTarget(cmGeneratorTarget const* target,
std::set<cmGeneratorTarget const*>& emitted)
{
size_t count = 0;
if(emitted.insert(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)
{
@ -935,10 +935,10 @@ cmGlobalUnixMakefileGenerator3
::CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg)
{
size_t count = 0;
std::set<cmTarget const*> emitted;
std::set<cmTarget const*> const& targets
std::set<cmGeneratorTarget const*> emitted;
std::set<cmGeneratorTarget const*> const& targets
= this->LocalGeneratorToTargetMap[lg];
for(std::set<cmTarget const*>::const_iterator t = targets.begin();
for(std::set<cmGeneratorTarget const*>::const_iterator t = targets.begin();
t != targets.end(); ++t)
{
count += this->CountProgressMarksInTarget(*t, emitted);
@ -987,22 +987,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);
}

View File

@ -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,8 +198,8 @@ protected:
cmStrictTargetComparison> ProgressMapType;
ProgressMapType ProgressMap;
size_t CountProgressMarksInTarget(cmTarget const* target,
std::set<cmTarget const*>& emitted);
size_t CountProgressMarksInTarget(cmGeneratorTarget const* target,
std::set<cmGeneratorTarget const*>& emitted);
size_t CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg);
cmGeneratedFileStream *CommandDatabase;

View File

@ -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;

View File

@ -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;
}

View File

@ -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)

View File

@ -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(

View File

@ -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;

View File

@ -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);
}

View File

@ -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

View File

@ -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;