Use modern global dependency graph for VS < 8 deps

VS 7.1 and below have 2 behaviors that make the cmComputeTargetDepends
result difficult to use for solution-level dependencies.  Update the
method cmGlobalVisualStudioGenerator::ComputeTargetDepends to document
the behaviors and work around them.  Commit 1a0c166a (Store direct
dependencies in solutions for VS >= 8, 2010-08-20) isolated VS >= 8 from
this computation so those versions should be unaffected.

This change removes the last use of cmTarget::GetLinkLibraries for
purposes other than backward compatibility with legacy interfaces
(export_library_dependencies, VS 6 custom .dsp templates).  Now the
cmComputeTargetDepends results are used for all generators so global
target dependency computation is fully centralized.
This commit is contained in:
Brad King
2010-08-25 10:26:25 -04:00
parent 605f4bc097
commit fd614e60b5
2 changed files with 162 additions and 79 deletions

View File

@@ -69,15 +69,12 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
virtual bool IsMultiConfig() { return true; }
class TargetSet: public std::set<cmTarget*> {};
struct TargetCompare
{
bool operator()(cmTarget const* l, cmTarget const* r) const;
};
class OrderedTargetDependSet: public std::multiset<cmTarget*, TargetCompare>
{
public:
OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&);
};
class OrderedTargetDependSet;
protected:
// Does this VS version link targets to each other if there are
@@ -99,6 +96,24 @@ protected:
std::string GetUtilityDepend(cmTarget* target);
typedef std::map<cmTarget*, cmStdString> UtilityDependsMap;
UtilityDependsMap UtilityDepends;
private:
void FollowLinkDepends(cmTarget* target, std::set<cmTarget*>& linked);
class TargetSetMap: public std::map<cmTarget*, TargetSet> {};
TargetSetMap TargetLinkClosure;
void FillLinkClosure(cmTarget* target, TargetSet& linked);
TargetSet const& GetTargetLinkClosure(cmTarget* target);
};
class cmGlobalVisualStudioGenerator::OrderedTargetDependSet:
public std::multiset<cmTargetDepend,
cmGlobalVisualStudioGenerator::TargetCompare>
{
public:
typedef cmGlobalGenerator::TargetDependSet TargetDependSet;
typedef cmGlobalVisualStudioGenerator::TargetSet TargetSet;
OrderedTargetDependSet(TargetDependSet const&);
OrderedTargetDependSet(TargetSet const&);
};
#endif