MCPcopy Index your code
hub / github.com/Kitware/CMake / FindPackageUsingConfigMode

Method FindPackageUsingConfigMode

Source/cmFindPackageCommand.cxx:1360–1412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1358}
1359
1360bool cmFindPackageCommand::FindPackageUsingConfigMode()
1361{
1362 this->Variable = cmStrCat(this->Name, "_DIR");
1363
1364 // Add the default name.
1365 if (this->Names.empty()) {
1366 this->Names.push_back(this->Name);
1367 }
1368
1369 // Add the default configs.
1370 if (this->Configs.empty()) {
1371 for (std::string const& n : this->Names) {
1372 std::string config;
1373 if (this->UseCpsFiles) {
1374 config = cmStrCat(n, ".cps");
1375 this->Configs.emplace_back(std::move(config), pdt::Cps);
1376
1377 config = cmStrCat(cmSystemTools::LowerCase(n), ".cps");
1378 if (config != this->Configs.back().Name) {
1379 this->Configs.emplace_back(std::move(config), pdt::Cps);
1380 }
1381 }
1382
1383 config = cmStrCat(n, "Config.cmake");
1384 this->Configs.emplace_back(std::move(config), pdt::CMake);
1385
1386 config = cmStrCat(cmSystemTools::LowerCase(n), "-config.cmake");
1387 this->Configs.emplace_back(std::move(config), pdt::CMake);
1388 }
1389 }
1390
1391 // get igonored paths from vars and reroot them.
1392 std::vector<std::string> ignored;
1393 this->GetIgnoredPaths(ignored);
1394 this->RerootPaths(ignored);
1395
1396 // Construct a set of ignored paths
1397 this->IgnoredPaths.clear();
1398 this->IgnoredPaths.insert(ignored.begin(), ignored.end());
1399
1400 // get igonored prefix paths from vars and reroot them.
1401 std::vector<std::string> ignoredPrefixes;
1402 this->GetIgnoredPrefixPaths(ignoredPrefixes);
1403 this->RerootPaths(ignoredPrefixes);
1404
1405 // Construct a set of ignored prefix paths
1406 this->IgnoredPrefixPaths.clear();
1407 this->IgnoredPrefixPaths.insert(ignoredPrefixes.begin(),
1408 ignoredPrefixes.end());
1409
1410 // Find and load the package.
1411 return this->HandlePackageMode(HandlePackageModeType::Config);
1412}
1413
1414void cmFindPackageCommand::SetVersionVariables(
1415 std::function<void(std::string const&, cm::string_view)> const&

Callers 1

FindPackageMethod · 0.95

Calls 14

HandlePackageModeMethod · 0.95
moveFunction · 0.85
push_backMethod · 0.80
emplace_backMethod · 0.80
GetIgnoredPathsMethod · 0.80
RerootPathsMethod · 0.80
GetIgnoredPrefixPathsMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45
backMethod · 0.45
clearMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected