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

Method HaveRequiredLanguages

Source/cmCommonTargetGenerator.cxx:576–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576bool cmCommonTargetGenerator::HaveRequiredLanguages(
577 std::vector<cmSourceFile const*> const& sources,
578 std::set<std::string>& languagesNeeded) const
579{
580 for (cmSourceFile const* sf : sources) {
581 languagesNeeded.insert(sf->GetLanguage());
582 }
583
584 auto* makefile = this->Makefile;
585 auto* state = makefile->GetState();
586 auto unary = [&state, &makefile](std::string const& lang) -> bool {
587 bool const valid = state->GetLanguageEnabled(lang);
588 if (!valid) {
589 makefile->IssueMessage(
590 MessageType::FATAL_ERROR,
591 cmStrCat("The language ", lang,
592 " was requested for compilation but was not enabled."
593 " To enable a language it needs to be specified in a"
594 " 'project' or 'enable_language' command in the root"
595 " CMakeLists.txt"));
596 }
597 return valid;
598 };
599 return std::all_of(languagesNeeded.cbegin(), languagesNeeded.cend(), unary);
600}

Callers 2

WriteTargetBuildRulesMethod · 0.80
WriteLanguagesRulesMethod · 0.80

Calls 8

GetLanguageMethod · 0.80
cbeginMethod · 0.80
cendMethod · 0.80
cmStrCatFunction · 0.70
insertMethod · 0.45
GetStateMethod · 0.45
GetLanguageEnabledMethod · 0.45
IssueMessageMethod · 0.45

Tested by

no test coverage detected