| 1358 | } |
| 1359 | |
| 1360 | bool 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 | |
| 1414 | void cmFindPackageCommand::SetVersionVariables( |
| 1415 | std::function<void(std::string const&, cm::string_view)> const& |
no test coverage detected