mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-07 08:10:48 +00:00
cmComputeTargetDepends: Avoid nested loops over configurations
`AddInterfaceDepends` is only called from `CollectTargetDepends` inside our loop over all configurations so it doesn't need its own such loop.
This commit is contained in:
@@ -238,7 +238,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
|
|||||||
// Don't emit the same library twice for this target.
|
// Don't emit the same library twice for this target.
|
||||||
if (emitted.insert(*lib).second) {
|
if (emitted.insert(*lib).second) {
|
||||||
this->AddTargetDepend(depender_index, *lib, true);
|
this->AddTargetDepend(depender_index, *lib, true);
|
||||||
this->AddInterfaceDepends(depender_index, *lib, emitted);
|
this->AddInterfaceDepends(depender_index, *lib, *it, emitted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
|
|||||||
// Don't emit the same library twice for this target.
|
// Don't emit the same library twice for this target.
|
||||||
if (emitted.insert(*lib).second) {
|
if (emitted.insert(*lib).second) {
|
||||||
this->AddTargetDepend(depender_index, *lib, true);
|
this->AddTargetDepend(depender_index, *lib, true);
|
||||||
this->AddInterfaceDepends(depender_index, *lib, emitted);
|
this->AddInterfaceDepends(depender_index, *lib, config, emitted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,7 +281,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
|
|||||||
|
|
||||||
void cmComputeTargetDepends::AddInterfaceDepends(
|
void cmComputeTargetDepends::AddInterfaceDepends(
|
||||||
int depender_index, cmLinkItem const& dependee_name,
|
int depender_index, cmLinkItem const& dependee_name,
|
||||||
std::set<std::string>& emitted)
|
const std::string& config, std::set<std::string>& emitted)
|
||||||
{
|
{
|
||||||
cmGeneratorTarget const* depender = this->Targets[depender_index];
|
cmGeneratorTarget const* depender = this->Targets[depender_index];
|
||||||
cmGeneratorTarget const* dependee = dependee_name.Target;
|
cmGeneratorTarget const* dependee = dependee_name.Target;
|
||||||
@@ -294,17 +294,9 @@ void cmComputeTargetDepends::AddInterfaceDepends(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dependee) {
|
if (dependee) {
|
||||||
std::vector<std::string> configs;
|
// A target should not depend on itself.
|
||||||
depender->Makefile->GetConfigurations(configs);
|
emitted.insert(depender->GetName());
|
||||||
if (configs.empty()) {
|
this->AddInterfaceDepends(depender_index, dependee, config, emitted);
|
||||||
configs.push_back("");
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ private:
|
|||||||
bool linking);
|
bool linking);
|
||||||
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
|
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
|
||||||
void AddInterfaceDepends(int depender_index, cmLinkItem const& dependee_name,
|
void AddInterfaceDepends(int depender_index, cmLinkItem const& dependee_name,
|
||||||
|
const std::string& config,
|
||||||
std::set<std::string>& emitted);
|
std::set<std::string>& emitted);
|
||||||
void AddInterfaceDepends(int depender_index,
|
void AddInterfaceDepends(int depender_index,
|
||||||
cmGeneratorTarget const* dependee,
|
cmGeneratorTarget const* dependee,
|
||||||
|
|||||||
Reference in New Issue
Block a user