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

Method CheckCompileFeaturesAvailable

Source/cmStandardLevelResolver.cxx:594–631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592}
593
594bool cmStandardLevelResolver::CheckCompileFeaturesAvailable(
595 std::string const& targetName, std::string const& feature, std::string& lang,
596 std::string* error) const
597{
598 if (!this->CompileFeatureKnown(targetName, feature, lang, error)) {
599 return false;
600 }
601
602 if (!this->Makefile->GetGlobalGenerator()->GetLanguageEnabled(lang)) {
603 return true;
604 }
605
606 cmValue features = this->CompileFeaturesAvailable(lang, error);
607 if (!features) {
608 return false;
609 }
610
611 cmList availableFeatures{ features };
612 if (!cm::contains(availableFeatures, feature)) {
613 std::ostringstream e;
614 e << "The compiler feature \"" << feature << "\" is not known to " << lang
615 << " compiler\n\""
616 << this->Makefile->GetSafeDefinition(
617 cmStrCat("CMAKE_", lang, "_COMPILER_ID"))
618 << "\"\nversion "
619 << this->Makefile->GetSafeDefinition(
620 cmStrCat("CMAKE_", lang, "_COMPILER_VERSION"))
621 << '.';
622 if (error) {
623 *error = e.str();
624 } else {
625 this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
626 }
627 return false;
628 }
629
630 return true;
631}
632
633bool cmStandardLevelResolver::CompileFeatureKnown(
634 std::string const& targetName, std::string const& feature, std::string& lang,

Callers 2

Calls 7

CompileFeatureKnownMethod · 0.95
strMethod · 0.80
cmStrCatFunction · 0.70
GetLanguageEnabledMethod · 0.45
GetGlobalGeneratorMethod · 0.45
IssueMessageMethod · 0.45

Tested by

no test coverage detected