summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeTargetDepends.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r--Source/cmComputeTargetDepends.cxx50
1 files changed, 27 insertions, 23 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index edda2bd..268e749 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -195,7 +195,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// dependencies in all targets, because the generated build-systems can't
// deal with config-specific dependencies.
{
- std::set<std::string> emitted;
+ std::set<cmLinkItem> emitted;
std::vector<std::string> configs;
depender->Makefile->GetConfigurations(configs);
@@ -206,30 +206,34 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
std::vector<cmSourceFile const*> objectFiles;
depender->GetExternalObjects(objectFiles, it);
for (cmSourceFile const* o : objectFiles) {
- std::string objLib = o->GetObjectLibrary();
- if (!objLib.empty() && emitted.insert(objLib).second) {
- if (depender->GetType() != cmStateEnums::EXECUTABLE &&
- depender->GetType() != cmStateEnums::STATIC_LIBRARY &&
- depender->GetType() != cmStateEnums::SHARED_LIBRARY &&
- depender->GetType() != cmStateEnums::MODULE_LIBRARY &&
- depender->GetType() != cmStateEnums::OBJECT_LIBRARY) {
- this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
- cmake::FATAL_ERROR,
- "Only executables and libraries may reference target objects.",
- depender->GetBacktrace());
- return;
+ std::string const& objLib = o->GetObjectLibrary();
+ if (!objLib.empty()) {
+ cmLinkItem const& objItem = depender->ResolveLinkItem(objLib);
+ if (emitted.insert(objItem).second) {
+ if (depender->GetType() != cmStateEnums::EXECUTABLE &&
+ depender->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ depender->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ depender->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ depender->GetType() != cmStateEnums::OBJECT_LIBRARY) {
+ this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
+ cmake::FATAL_ERROR,
+ "Only executables and libraries may reference target objects.",
+ depender->GetBacktrace());
+ return;
+ }
+ const_cast<cmGeneratorTarget*>(depender)->Target->AddUtility(
+ objLib);
}
- const_cast<cmGeneratorTarget*>(depender)->Target->AddUtility(objLib);
}
}
cmLinkImplementation const* impl = depender->GetLinkImplementation(it);
// A target should not depend on itself.
- emitted.insert(depender->GetName());
+ emitted.insert(cmLinkItem(depender));
for (cmLinkImplItem const& lib : impl->Libraries) {
// Don't emit the same library twice for this target.
- if (emitted.insert(lib.AsStr()).second) {
+ if (emitted.insert(lib).second) {
this->AddTargetDepend(depender_index, lib, true);
this->AddInterfaceDepends(depender_index, lib, it, emitted);
}
@@ -240,12 +244,12 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Loop over all utility dependencies.
{
std::set<cmLinkItem> const& tutils = depender->GetUtilityItems();
- std::set<std::string> emitted;
+ std::set<cmLinkItem> emitted;
// A target should not depend on itself.
- emitted.insert(depender->GetName());
+ emitted.insert(cmLinkItem(depender));
for (cmLinkItem const& litem : tutils) {
// Don't emit the same utility twice for this target.
- if (emitted.insert(litem.AsStr()).second) {
+ if (emitted.insert(litem).second) {
this->AddTargetDepend(depender_index, litem, false);
}
}
@@ -254,14 +258,14 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
void cmComputeTargetDepends::AddInterfaceDepends(
int depender_index, const cmGeneratorTarget* dependee,
- const std::string& config, std::set<std::string>& emitted)
+ const std::string& config, std::set<cmLinkItem>& emitted)
{
cmGeneratorTarget const* depender = this->Targets[depender_index];
if (cmLinkInterface const* iface =
dependee->GetLinkInterface(config, depender)) {
for (cmLinkItem const& lib : iface->Libraries) {
// Don't emit the same library twice for this target.
- if (emitted.insert(lib.AsStr()).second) {
+ if (emitted.insert(lib).second) {
this->AddTargetDepend(depender_index, lib, true);
this->AddInterfaceDepends(depender_index, lib, config, emitted);
}
@@ -271,7 +275,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
void cmComputeTargetDepends::AddInterfaceDepends(
int depender_index, cmLinkItem const& dependee_name,
- const std::string& config, std::set<std::string>& emitted)
+ const std::string& config, std::set<cmLinkItem>& emitted)
{
cmGeneratorTarget const* depender = this->Targets[depender_index];
cmGeneratorTarget const* dependee = dependee_name.Target;
@@ -285,7 +289,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
if (dependee) {
// A target should not depend on itself.
- emitted.insert(depender->GetName());
+ emitted.insert(cmLinkItem(depender));
this->AddInterfaceDepends(depender_index, dependee, config, emitted);
}
}