| 3449 | } |
| 3450 | |
| 3451 | bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config) |
| 3452 | { |
| 3453 | cmStandardLevelResolver standardResolver(this->Makefile); |
| 3454 | |
| 3455 | for (std::string const& lang : |
| 3456 | this->Makefile->GetState()->GetEnabledLanguages()) { |
| 3457 | if (cmValue languageStd = this->GetLanguageStandard(lang, config)) { |
| 3458 | if (cm::optional<cmStandardLevel> langLevel = |
| 3459 | standardResolver.LanguageStandardLevel(lang, *languageStd)) { |
| 3460 | this->UpdateExplicitStandardLevel(lang, config, *langLevel); |
| 3461 | } |
| 3462 | } |
| 3463 | } |
| 3464 | |
| 3465 | // Compute the language standard based on the compile features. |
| 3466 | std::vector<BT<std::string>> features = this->GetCompileFeatures(config); |
| 3467 | for (BT<std::string> const& f : features) { |
| 3468 | std::string lang; |
| 3469 | if (!standardResolver.CompileFeatureKnown(this->Target->GetName(), f.Value, |
| 3470 | lang, nullptr)) { |
| 3471 | return false; |
| 3472 | } |
| 3473 | |
| 3474 | std::string key = cmStrCat(cmSystemTools::UpperCase(config), '-', lang); |
| 3475 | cmValue currentLanguageStandard = this->GetLanguageStandard(lang, config); |
| 3476 | |
| 3477 | cm::optional<cmStandardLevel> featureLevel; |
| 3478 | std::string newRequiredStandard; |
| 3479 | if (!standardResolver.GetNewRequiredStandard( |
| 3480 | this->Target->GetName(), f.Value, currentLanguageStandard, |
| 3481 | featureLevel, newRequiredStandard)) { |
| 3482 | return false; |
| 3483 | } |
| 3484 | |
| 3485 | if (featureLevel) { |
| 3486 | this->UpdateExplicitStandardLevel(lang, config, *featureLevel); |
| 3487 | } |
| 3488 | |
| 3489 | if (!newRequiredStandard.empty()) { |
| 3490 | BTs<std::string>& languageStandardProperty = |
| 3491 | this->LanguageStandardMap[key]; |
| 3492 | if (languageStandardProperty.Value != newRequiredStandard) { |
| 3493 | languageStandardProperty.Value = newRequiredStandard; |
| 3494 | languageStandardProperty.Backtraces.clear(); |
| 3495 | } |
| 3496 | languageStandardProperty.Backtraces.emplace_back(f.Backtrace); |
| 3497 | } |
| 3498 | } |
| 3499 | |
| 3500 | return true; |
| 3501 | } |
| 3502 | |
| 3503 | bool cmGeneratorTarget::ComputeCompileFeatures( |
| 3504 | std::string const& config, std::set<LanguagePair> const& languagePairs) |
no test coverage detected