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

Method AddProject

Source/cmFileAPICodemodel.cxx:687–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687Json::ArrayIndex CodemodelConfig::AddProject(cmStateSnapshot s)
688{
689 cmStateSnapshot ps = s.GetBuildsystemDirectoryParent();
690 if (ps.IsValid() && ps.GetProjectName() == s.GetProjectName()) {
691 // This directory is part of its parent directory project.
692 Json::ArrayIndex const parentDirIndex = this->GetDirectoryIndex(ps);
693 return this->Directories[parentDirIndex].ProjectIndex;
694 }
695
696 // This directory starts a new project.
697 auto projectIndex = static_cast<Json::ArrayIndex>(this->Projects.size());
698 this->Projects.emplace_back();
699 Project& p = this->Projects[projectIndex];
700 p.Snapshot = s;
701 this->ProjectMap[s] = projectIndex;
702 if (ps.IsValid()) {
703 Json::ArrayIndex const parentDirIndex = this->GetDirectoryIndex(ps);
704 p.ParentIndex = this->Directories[parentDirIndex].ProjectIndex;
705 this->Projects[p.ParentIndex].ChildIndexes.append(projectIndex);
706 }
707 return projectIndex;
708}
709
710CodemodelConfig::DumpedTargets CodemodelConfig::DumpTargets()
711{

Callers 2

ProcessDirectoriesMethod · 0.95
ProcessMethod · 0.45

Calls 7

GetDirectoryIndexMethod · 0.95
emplace_backMethod · 0.80
appendMethod · 0.80
IsValidMethod · 0.45
GetProjectNameMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected