cmEnableLanguageCommand.cxx 797 B

1234567891011121314151617181920212223242526272829
  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 "cmMakefile.h"
  5. class cmExecutionStatus;
  6. // cmEnableLanguageCommand
  7. bool cmEnableLanguageCommand::InitialPass(std::vector<std::string> const& args,
  8. cmExecutionStatus&)
  9. {
  10. bool optional = false;
  11. std::vector<std::string> languages;
  12. if (args.empty()) {
  13. this->SetError("called with incorrect number of arguments");
  14. return false;
  15. }
  16. for (std::string const& it : args) {
  17. if (it == "OPTIONAL") {
  18. optional = true;
  19. } else {
  20. languages.push_back(it);
  21. }
  22. }
  23. this->Makefile->EnableLanguage(languages, optional);
  24. return true;
  25. }