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

Method CompileFeatureKnown

Source/cmStandardLevelResolver.cxx:633–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631}
632
633bool cmStandardLevelResolver::CompileFeatureKnown(
634 std::string const& targetName, std::string const& feature, std::string& lang,
635 std::string* error) const
636{
637 assert(cmGeneratorExpression::Find(feature) == std::string::npos);
638
639 bool isCFeature =
640 std::find_if(cm::cbegin(C_FEATURES) + 1, cm::cend(C_FEATURES),
641 cmStrCmp(feature)) != cm::cend(C_FEATURES);
642 if (isCFeature) {
643 lang = "C";
644 return true;
645 }
646 bool isCxxFeature =
647 std::find_if(cm::cbegin(CXX_FEATURES) + 1, cm::cend(CXX_FEATURES),
648 cmStrCmp(feature)) != cm::cend(CXX_FEATURES);
649 if (isCxxFeature) {
650 lang = "CXX";
651 return true;
652 }
653 bool isCudaFeature =
654 std::find_if(cm::cbegin(CUDA_FEATURES) + 1, cm::cend(CUDA_FEATURES),
655 cmStrCmp(feature)) != cm::cend(CUDA_FEATURES);
656 if (isCudaFeature) {
657 lang = "CUDA";
658 return true;
659 }
660 bool isHIPFeature =
661 std::find_if(cm::cbegin(HIP_FEATURES) + 1, cm::cend(HIP_FEATURES),
662 cmStrCmp(feature)) != cm::cend(HIP_FEATURES);
663 if (isHIPFeature) {
664 lang = "HIP";
665 return true;
666 }
667 std::ostringstream e;
668 if (error) {
669 e << "specified";
670 } else {
671 e << "Specified";
672 }
673 e << " unknown feature \"" << feature
674 << "\" for "
675 "target \""
676 << targetName << "\".";
677 if (error) {
678 *error = e.str();
679 } else {
680 this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
681 }
682 return false;
683}
684
685cm::optional<cmStandardLevel>
686cmStandardLevelResolver::CompileFeatureStandardLevel(

Callers 3

EvaluateMethod · 0.80

Calls 3

cmStrCmpClass · 0.85
strMethod · 0.80
IssueMessageMethod · 0.45

Tested by

no test coverage detected