| 2231 | } |
| 2232 | |
| 2233 | bool cmFindPackageCommand::ImportPackageTargets(cmPackageState& packageState, |
| 2234 | std::string const& filePath, |
| 2235 | cmPackageInfoReader& reader) |
| 2236 | { |
| 2237 | // Check if we've already imported this file. |
| 2238 | std::string fileName = cmSystemTools::GetFilenameName(filePath); |
| 2239 | if (cm::contains(packageState.ImportedFiles, fileName)) { |
| 2240 | return true; |
| 2241 | } |
| 2242 | |
| 2243 | // Import base file. |
| 2244 | if (!reader.ImportTargets(this->Makefile, this->Status, this->GlobalScope)) { |
| 2245 | return false; |
| 2246 | } |
| 2247 | |
| 2248 | // Find supplemental configuration files. |
| 2249 | cmsys::Glob glob; |
| 2250 | glob.RecurseOff(); |
| 2251 | if (glob.FindFiles( |
| 2252 | cmStrCat(cmSystemTools::GetFilenamePath(filePath), '/', |
| 2253 | cmSystemTools::GetFilenameWithoutExtension(filePath), |
| 2254 | "@*.[Cc][Pp][Ss]"_s))) { |
| 2255 | |
| 2256 | // Try to read supplemental data from each file found. |
| 2257 | for (std::string const& extra : glob.GetFiles()) { |
| 2258 | cmMakefile::CallRAII cs{ this->Makefile, extra, this->Status }; |
| 2259 | |
| 2260 | std::unique_ptr<cmPackageInfoReader> configReader = |
| 2261 | cmPackageInfoReader::Read(this->Makefile, extra, &reader); |
| 2262 | if (configReader && configReader->GetName() == this->Name) { |
| 2263 | if (!configReader->ImportTargetConfigurations(this->Makefile, |
| 2264 | this->Status)) { |
| 2265 | return false; |
| 2266 | } |
| 2267 | } |
| 2268 | } |
| 2269 | } |
| 2270 | |
| 2271 | packageState.ImportedFiles.emplace(std::move(fileName)); |
| 2272 | return true; |
| 2273 | } |
| 2274 | |
| 2275 | void cmFindPackageCommand::AppendToFoundProperty(bool const found) |
| 2276 | { |
no test coverage detected