| /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
| file LICENSE.rst or https://cmake.org/licensing for details. */ |
| #include "cmEnableLanguageCommand.h" |
| #include "cmExecutionStatus.h" |
| #include "cmMessageType.h" |
| #include "cmSystemTools.h" |
| bool cmEnableLanguageCommand(std::vector<std::string> const& args, |
| cmExecutionStatus& status) |
| status.SetError("called with incorrect number of arguments"); |
| cmMakefile& mf = status.GetMakefile(); |
| if (!mf.IsNormalDefinitionSet("PROJECT_NAME")) { |
| switch (mf.GetPolicyStatus(cmPolicies::CMP0165)) { |
| MessageType::AUTHOR_WARNING, |
| "project() should be called prior to this enable_language() call."); |
| MessageType::FATAL_ERROR, |
| "project() must be called prior to this enable_language() call."); |
| cmSystemTools::SetFatalErrorOccurred(); |
| std::vector<std::string> languages; |
| for (std::string const& it : args) { |
| mf.EnableLanguage(languages, optional); |