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

Method SetupGroupComponentVariables

Source/CPack/cmCPackNuGetGenerator.cxx:65–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup)
66{
67 // The default behavior is to have one package by component group
68 // unless CPACK_COMPONENTS_IGNORE_GROUP is specified.
69 if (!ignoreGroup) {
70 std::vector<std::string> groups;
71 for (auto const& compG : this->ComponentGroups) {
72 cmCPackLogger(cmCPackLog::LOG_VERBOSE,
73 "Packaging component group: " << compG.first << std::endl);
74 groups.push_back(compG.first);
75 auto compGUp =
76 cmSystemTools::UpperCase(cmSystemTools::MakeCidentifier(compG.first));
77
78 // Collect components for this group
79 std::vector<std::string> components;
80 std::transform(begin(compG.second.Components),
81 end(compG.second.Components),
82 std::back_inserter(components),
83 [](cmCPackComponent const* comp) { return comp->Name; });
84 this->SetOption("CPACK_NUGET_" + compGUp + "_GROUP_COMPONENTS",
85 cmList::to_string(components));
86 }
87 if (!groups.empty()) {
88 this->SetOption("CPACK_NUGET_GROUPS", cmList::to_string(groups));
89 }
90
91 // Handle Orphan components (components not belonging to any groups)
92 std::vector<std::string> components;
93 for (auto const& comp : this->Components) {
94 // Does the component belong to a group?
95 if (!comp.second.Group) {
96 cmCPackLogger(
97 cmCPackLog::LOG_VERBOSE,
98 "Component <"
99 << comp.second.Name
100 << "> does not belong to any group, package it separately."
101 << std::endl);
102 components.push_back(comp.first);
103 }
104 }
105 if (!components.empty()) {
106 this->SetOption("CPACK_NUGET_COMPONENTS", cmList::to_string(components));
107 }
108
109 } else {
110 std::vector<std::string> components;
111 components.reserve(this->Components.size());
112 std::transform(begin(this->Components), end(this->Components),
113 std::back_inserter(components),
114 [](std::pair<std::string, cmCPackComponent> const& comp) {
115 return comp.first;
116 });
117 this->SetOption("CPACK_NUGET_COMPONENTS", cmList::to_string(components));
118 }
119}
120
121void cmCPackNuGetGenerator::AddGeneratedPackageNames()
122{

Callers 1

PackageFilesMethod · 0.95

Calls 7

transformFunction · 0.85
to_stringFunction · 0.85
push_backMethod · 0.80
reserveMethod · 0.80
SetOptionMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected