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

Method FindConfigFile

Source/cmFindPackageCommand.cxx:2915–2949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2913}
2914
2915bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
2916 PackageDescriptionType type,
2917 std::string& file,
2918 FoundPackageMode& foundMode)
2919{
2920 for (auto const& config : this->Configs) {
2921 if (type != pdt::Any && config.Type != type) {
2922 continue;
2923 }
2924 file = cmStrCat(dir, '/', config.Name);
2925 if (this->DebugModeEnabled()) {
2926 this->DebugBuffer = cmStrCat(this->DebugBuffer, " ", file, '\n');
2927 }
2928 if (cmSystemTools::FileExists(file, true)) {
2929 // Allow resolving symlinks when the config file is found through a link
2930 if (this->UseRealPath) {
2931 file = cmSystemTools::GetRealPath(file);
2932 } else {
2933 file = cmSystemTools::ToNormalizedPathOnDisk(file);
2934 }
2935 if (this->CheckVersion(file)) {
2936 foundMode = cmFindPackageCommand::FoundMode(config.Type);
2937 return true;
2938 }
2939 this->ConsideredPaths.emplace_back(
2940 file, cmFindPackageCommand::FoundMode(type),
2941 this->ConsideredConfigs.back().result,
2942 this->ConsideredConfigs.back().message);
2943 } else {
2944 this->ConsideredPaths.emplace_back(
2945 file, cmFindPackageCommand::FoundMode(type), SearchResult::NoExist);
2946 }
2947 }
2948 return false;
2949}
2950
2951bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
2952{

Callers 2

HandlePackageModeMethod · 0.95
CheckDirectoryMethod · 0.95

Calls 7

CheckVersionMethod · 0.95
GetRealPathFunction · 0.85
DebugModeEnabledMethod · 0.80
emplace_backMethod · 0.80
cmStrCatFunction · 0.70
FileExistsFunction · 0.50
backMethod · 0.45

Tested by

no test coverage detected