| 574 | } |
| 575 | |
| 576 | bool 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 | } |
no test coverage detected