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

Method FindPackageDependencies

Source/cmFindPackageCommand.cxx:2190–2231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2188}
2189
2190bool cmFindPackageCommand::FindPackageDependencies(
2191 std::string const& filePath, cmPackageInfoReader const& reader,
2192 RequiredStatus required)
2193{
2194 // Get package requirements.
2195 for (cmPackageRequirement const& dep : reader.GetRequirements()) {
2196 cmExecutionStatus status{ *this->Makefile };
2197 cmMakefile::CallRAII scope{ this->Makefile, filePath, status };
2198
2199 // For each requirement, set up a nested instance to find it.
2200 cmFindPackageCommand fp{ status };
2201 fp.InheritOptions(this);
2202
2203 fp.Name = dep.Name;
2204 fp.Required = required;
2205 fp.UseFindModules = false;
2206 fp.UseCpsFiles = true;
2207
2208 fp.Version = dep.Version;
2209 fp.VersionComplete = dep.Version;
2210 fp.VersionCount =
2211 parseVersion(fp.Version, fp.VersionMajor, fp.VersionMinor,
2212 fp.VersionPatch, fp.VersionTweak);
2213
2214 fp.Components = cmJoin(cmMakeRange(dep.Components), ";"_s);
2215 fp.OptionalComponents =
2216 std::set<std::string>{ dep.Components.begin(), dep.Components.end() };
2217 fp.RequiredTargets = fp.OptionalComponents;
2218
2219 // TODO set hints
2220
2221 // Try to find the requirement; fail if we can't.
2222 if (!fp.FindPackage() || fp.FileFound.empty()) {
2223 this->SetError(cmStrCat("could not find "_s, dep.Name,
2224 ", required by "_s, this->Name, '.'));
2225 return false;
2226 }
2227 }
2228
2229 // All requirements (if any) were found.
2230 return true;
2231}
2232
2233bool cmFindPackageCommand::ImportPackageTargets(cmPackageState& packageState,
2234 std::string const& filePath,

Callers 1

ReadPackageMethod · 0.95

Calls 11

parseVersionFunction · 0.85
cmMakeRangeFunction · 0.85
GetRequirementsMethod · 0.80
InheritOptionsMethod · 0.80
cmJoinFunction · 0.70
cmStrCatFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
FindPackageMethod · 0.45
emptyMethod · 0.45
SetErrorMethod · 0.45

Tested by

no test coverage detected