ENH: Keep target information in final link line

In cmComputeLinkInformation items in the final link line returned by
GetItems now contain a pointer to their corresponding cmTarget if they
were produced by a target.  This makes available the set of all targets
linked.
This commit is contained in:
Brad King 2008-09-15 13:30:07 -04:00
parent 76c5697a16
commit 0fe06c8126
2 changed files with 8 additions and 5 deletions

View File

@ -594,7 +594,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
std::string exe = tgt->GetFullPath(config, this->UseImportLibrary, std::string exe = tgt->GetFullPath(config, this->UseImportLibrary,
true); true);
linkItem += exe; linkItem += exe;
this->Items.push_back(Item(linkItem, true)); this->Items.push_back(Item(linkItem, true, tgt));
this->Depends.push_back(exe); this->Depends.push_back(exe);
} }
else else
@ -1020,7 +1020,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
} }
// Now add the full path to the library. // Now add the full path to the library.
this->Items.push_back(Item(item, true)); this->Items.push_back(Item(item, true, target));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -40,11 +40,14 @@ public:
struct Item struct Item
{ {
Item(): Value(), IsPath(true) {} Item(): Value(), IsPath(true), Target(0) {}
Item(Item const& item): Value(item.Value), IsPath(item.IsPath) {} Item(Item const& item):
Item(std::string const& v, bool p): Value(v), IsPath(p) {} Value(item.Value), IsPath(item.IsPath), Target(item.Target) {}
Item(std::string const& v, bool p, cmTarget* target = 0):
Value(v), IsPath(p), Target(target) {}
std::string Value; std::string Value;
bool IsPath; bool IsPath;
cmTarget* Target;
}; };
typedef std::vector<Item> ItemVector; typedef std::vector<Item> ItemVector;
ItemVector const& GetItems(); ItemVector const& GetItems();