cmEnableLanguageCommand.cxx 763 B

12345678910111213141516171819202122232425262728
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmEnableLanguageCommand.h"
  4. #include "cmExecutionStatus.h"
  5. #include "cmMakefile.h"
  6. bool cmEnableLanguageCommand(std::vector<std::string> const& args,
  7. cmExecutionStatus& status)
  8. {
  9. if (args.empty()) {
  10. status.SetError("called with incorrect number of arguments");
  11. return false;
  12. }
  13. bool optional = false;
  14. std::vector<std::string> languages;
  15. for (std::string const& it : args) {
  16. if (it == "OPTIONAL") {
  17. optional = true;
  18. } else {
  19. languages.push_back(it);
  20. }
  21. }
  22. status.GetMakefile().EnableLanguage(languages, optional);
  23. return true;
  24. }