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

Method AddRequiredTargetFeature

Source/cmStandardLevelResolver.cxx:559–592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559bool cmStandardLevelResolver::AddRequiredTargetFeature(
560 cmTarget* target, std::string const& feature, std::string* error) const
561{
562 if (cmGeneratorExpression::Find(feature) != std::string::npos) {
563 target->AppendProperty("COMPILE_FEATURES", feature,
564 this->Makefile->GetBacktrace());
565 return true;
566 }
567
568 std::string lang;
569 if (!this->CheckCompileFeaturesAvailable(target->GetName(), feature, lang,
570 error)) {
571 return false;
572 }
573
574 target->AppendProperty("COMPILE_FEATURES", feature,
575 this->Makefile->GetBacktrace());
576
577 // FIXME: Add a policy to avoid updating the <LANG>_STANDARD target
578 // property due to COMPILE_FEATURES. The language standard selection
579 // should be done purely at generate time based on whatever the project
580 // code put in these properties explicitly. That is mostly true now,
581 // but for compatibility we need to continue updating the property here.
582 cm::optional<cmStandardLevel> featureLevel;
583 std::string newRequiredStandard;
584 bool succeeded = this->GetNewRequiredStandard(
585 target->GetName(), feature,
586 target->GetProperty(cmStrCat(lang, "_STANDARD")), featureLevel,
587 newRequiredStandard, error);
588 if (!newRequiredStandard.empty()) {
589 target->SetProperty(cmStrCat(lang, "_STANDARD"), newRequiredStandard);
590 }
591 return succeeded;
592}
593
594bool cmStandardLevelResolver::CheckCompileFeaturesAvailable(
595 std::string const& targetName, std::string const& feature, std::string& lang,

Callers 2

HandleDirectContentMethod · 0.80
CreateCxxStdlibTargetFunction · 0.80

Calls 9

cmStrCatFunction · 0.70
AppendPropertyMethod · 0.45
GetBacktraceMethod · 0.45
GetNameMethod · 0.45
GetPropertyMethod · 0.45
emptyMethod · 0.45
SetPropertyMethod · 0.45

Tested by

no test coverage detected