| 625 | } |
| 626 | |
| 627 | void CodemodelConfig::ProcessDirectories() |
| 628 | { |
| 629 | cmGlobalGenerator* gg = |
| 630 | this->FileAPI.GetCMakeInstance()->GetGlobalGenerator(); |
| 631 | auto const& localGens = gg->GetLocalGenerators(); |
| 632 | |
| 633 | // Add directories in forward order to process parents before children. |
| 634 | this->Directories.reserve(localGens.size()); |
| 635 | for (auto const& lg : localGens) { |
| 636 | auto directoryIndex = |
| 637 | static_cast<Json::ArrayIndex>(this->Directories.size()); |
| 638 | this->Directories.emplace_back(); |
| 639 | Directory& d = this->Directories[directoryIndex]; |
| 640 | d.Snapshot = lg->GetStateSnapshot().GetBuildsystemDirectory(); |
| 641 | d.LocalGenerator = lg.get(); |
| 642 | this->DirectoryMap[d.Snapshot] = directoryIndex; |
| 643 | |
| 644 | d.ProjectIndex = this->AddProject(d.Snapshot); |
| 645 | this->Projects[d.ProjectIndex].DirectoryIndexes.append(directoryIndex); |
| 646 | } |
| 647 | |
| 648 | // Update directories in reverse order to process children before parents. |
| 649 | for (auto di = this->Directories.rbegin(); di != this->Directories.rend(); |
| 650 | ++di) { |
| 651 | Directory& d = *di; |
| 652 | |
| 653 | // Accumulate the presence of install rules on the way up. |
| 654 | for (auto const& gen : |
| 655 | d.LocalGenerator->GetMakefile()->GetInstallGenerators()) { |
| 656 | if (!dynamic_cast<cmInstallSubdirectoryGenerator*>(gen.get())) { |
| 657 | d.HasInstallRule = true; |
| 658 | break; |
| 659 | } |
| 660 | } |
| 661 | if (!d.HasInstallRule) { |
| 662 | for (cmStateSnapshot const& child : d.Snapshot.GetChildren()) { |
| 663 | cmStateSnapshot childDir = child.GetBuildsystemDirectory(); |
| 664 | Json::ArrayIndex const childIndex = this->GetDirectoryIndex(childDir); |
| 665 | if (this->Directories[childIndex].HasInstallRule) { |
| 666 | d.HasInstallRule = true; |
| 667 | break; |
| 668 | } |
| 669 | } |
| 670 | } |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | Json::ArrayIndex CodemodelConfig::GetDirectoryIndex(cmLocalGenerator const* lg) |
| 675 | { |
no test coverage detected