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

Method SearchEnvironmentPrefix

Source/cmFindPackageCommand.cxx:3532–3558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3530}
3531
3532bool cmFindPackageCommand::SearchEnvironmentPrefix(std::string const& prefix)
3533{
3534 assert(!prefix.empty() && prefix.back() == '/');
3535
3536 // Skip this if the prefix does not exist.
3537 if (!cmSystemTools::FileIsDirectory(prefix)) {
3538 return false;
3539 }
3540
3541 auto searchFn = [this](std::string const& fullPath,
3542 PackageDescriptionType type) -> bool {
3543 return this->SearchDirectory(fullPath, type);
3544 };
3545
3546 auto pkgDirGen =
3547 cmProjectDirectoryListGenerator{ &this->Names, this->SortOrder,
3548 this->SortDirection, true };
3549
3550 // <environment-path>/(Foo|foo|FOO)/cps/
3551 if (TryGeneratedPaths(searchFn, pdt::Cps, prefix, pkgDirGen,
3552 cmAppendPathSegmentGenerator{ "cps"_s })) {
3553 return true;
3554 }
3555
3556 // <environment-path>/(Foo|foo|FOO)/
3557 return TryGeneratedPaths(searchFn, pdt::Cps, prefix, pkgDirGen);
3558}
3559
3560bool cmFindPackageCommand::IsRequired() const
3561{

Callers 1

FindEnvironmentConfigMethod · 0.95

Calls 4

SearchDirectoryMethod · 0.95
TryGeneratedPathsFunction · 0.85
emptyMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected