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

Method ComputeCompileFeatures

Source/cmGeneratorTarget.cxx:3451–3501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3449}
3450
3451bool 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
3503bool cmGeneratorTarget::ComputeCompileFeatures(
3504 std::string const& config, std::set<LanguagePair> const& languagePairs)

Callers 3

CreateCxxStdlibTargetFunction · 0.80

Calls 15

GetLanguageStandardMethod · 0.95
GetCompileFeaturesMethod · 0.95
CompileFeatureKnownMethod · 0.80
emplace_backMethod · 0.80
cmStrCatFunction · 0.70
GetEnabledLanguagesMethod · 0.45
GetStateMethod · 0.45
LanguageStandardLevelMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected