| 611 | } |
| 612 | |
| 613 | void cmComputeTargetDepends::ComplainAboutBadComponent( |
| 614 | cmComputeComponentGraph const& ccg, size_t c, bool strong) |
| 615 | { |
| 616 | // Construct the error message. |
| 617 | std::ostringstream e; |
| 618 | e << "The inter-target dependency graph contains the following " |
| 619 | << "strongly connected component (cycle):\n"; |
| 620 | std::vector<NodeList> const& components = ccg.GetComponents(); |
| 621 | std::vector<size_t> const& cmap = ccg.GetComponentMap(); |
| 622 | NodeList const& cl = components[c]; |
| 623 | for (size_t i : cl) { |
| 624 | // Get the depender. |
| 625 | cmGeneratorTarget const* depender = this->Targets[i]; |
| 626 | |
| 627 | // Describe the depender. |
| 628 | e << " \"" << depender->GetName() << "\" of type " |
| 629 | << cmState::GetTargetTypeName(depender->GetType()) << "\n"; |
| 630 | |
| 631 | // List its dependencies that are inside the component. |
| 632 | EdgeList const& nl = this->InitialGraph[i]; |
| 633 | for (cmGraphEdge const& ni : nl) { |
| 634 | size_t j = ni; |
| 635 | if (cmap[j] == c) { |
| 636 | cmGeneratorTarget const* dependee = this->Targets[j]; |
| 637 | e << " depends on \"" << dependee->GetName() << "\"" |
| 638 | << " (" << (ni.IsStrong() ? "strong" : "weak") << ")\n"; |
| 639 | } |
| 640 | } |
| 641 | } |
| 642 | if (strong) { |
| 643 | // Custom command executable dependencies cannot occur within a |
| 644 | // component of static libraries. The cycle must appear in calls |
| 645 | // to add_dependencies. |
| 646 | e << "The component contains at least one cycle consisting of strong " |
| 647 | << "dependencies (created by add_dependencies) that cannot be broken."; |
| 648 | } else if (this->NoCycles) { |
| 649 | e << "The GLOBAL_DEPENDS_NO_CYCLES global property is enabled, so " |
| 650 | << "cyclic dependencies are not allowed even among static libraries."; |
| 651 | } else { |
| 652 | e << "At least one of these targets is not a STATIC_LIBRARY. " |
| 653 | << "Cyclic dependencies are allowed only among static libraries."; |
| 654 | } |
| 655 | cmSystemTools::Error(e.str()); |
| 656 | } |
| 657 | |
| 658 | bool cmComputeTargetDepends::IntraComponent(std::vector<size_t> const& cmap, |
| 659 | size_t c, size_t i, size_t* head, |