MCPcopy Create free account
hub / github.com/Kitware/CMake / ProcessDirectories

Method ProcessDirectories

Source/cmFileAPICodemodel.cxx:627–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625}
626
627void 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
674Json::ArrayIndex CodemodelConfig::GetDirectoryIndex(cmLocalGenerator const* lg)
675{

Callers 1

DumpMethod · 0.95

Calls 15

AddProjectMethod · 0.95
GetDirectoryIndexMethod · 0.95
reserveMethod · 0.80
emplace_backMethod · 0.80
appendMethod · 0.80
rbeginMethod · 0.80
rendMethod · 0.80
GetChildrenMethod · 0.80
GetGlobalGeneratorMethod · 0.45
GetCMakeInstanceMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected