mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Merge topic 'module-depends-static-lib-cycle'
01d7860fdbNinja,Makefile: Restore Fortran module scanning in static library cycle846baa7c5bcmGlobalGenerator: Factor out helper to check target ordering Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8363
This commit is contained in:
@@ -165,6 +165,7 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories(
|
||||
{
|
||||
std::vector<std::string> dirs;
|
||||
std::set<cmGeneratorTarget const*> emitted;
|
||||
cmGlobalCommonGenerator* const gg = this->GlobalCommonGenerator;
|
||||
if (cmComputeLinkInformation* cli =
|
||||
this->GeneratorTarget->GetLinkInformation(config)) {
|
||||
cmComputeLinkInformation::ItemVector const& items = cli->GetItems();
|
||||
@@ -172,6 +173,8 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories(
|
||||
cmGeneratorTarget const* linkee = item.Target;
|
||||
if (linkee &&
|
||||
!linkee->IsImported()
|
||||
// Skip targets that build after this one in a static lib cycle.
|
||||
&& gg->TargetOrderIndexLess(linkee, this->GeneratorTarget)
|
||||
// We can ignore the INTERFACE_LIBRARY items because
|
||||
// Target->GetLinkInformation already processed their
|
||||
// link interface and they don't have any output themselves.
|
||||
|
||||
@@ -1727,8 +1727,7 @@ cmGlobalGenerator::GetLocalGeneratorTargetsInOrder(cmLocalGenerator* lg) const
|
||||
cm::append(gts, lg->GetGeneratorTargets());
|
||||
std::sort(gts.begin(), gts.end(),
|
||||
[this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) {
|
||||
return this->TargetOrderIndex.at(l) <
|
||||
this->TargetOrderIndex.at(r);
|
||||
return this->TargetOrderIndexLess(l, r);
|
||||
});
|
||||
return gts;
|
||||
}
|
||||
@@ -3068,6 +3067,12 @@ cmGlobalGenerator::GetTargetDirectDepends(cmGeneratorTarget const* target)
|
||||
return this->TargetDependencies[target];
|
||||
}
|
||||
|
||||
bool cmGlobalGenerator::TargetOrderIndexLess(cmGeneratorTarget const* l,
|
||||
cmGeneratorTarget const* r) const
|
||||
{
|
||||
return this->TargetOrderIndex.at(l) < this->TargetOrderIndex.at(r);
|
||||
}
|
||||
|
||||
bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
|
||||
{
|
||||
// The following is a list of targets reserved
|
||||
|
||||
@@ -479,6 +479,11 @@ public:
|
||||
TargetDependSet const& GetTargetDirectDepends(
|
||||
const cmGeneratorTarget* target);
|
||||
|
||||
// Return true if target 'l' occurs before 'r' in a global ordering
|
||||
// of targets that respects inter-target dependencies.
|
||||
bool TargetOrderIndexLess(cmGeneratorTarget const* l,
|
||||
cmGeneratorTarget const* r) const;
|
||||
|
||||
const std::map<std::string, std::vector<cmLocalGenerator*>>& GetProjectMap()
|
||||
const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user