cmEnableLanguageCommand.cxx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmEnableLanguageCommand.h"
  11. // cmEnableLanguageCommand
  12. bool cmEnableLanguageCommand::InitialPass(std::vector<std::string> const& args,
  13. cmExecutionStatus&)
  14. {
  15. bool optional = false;
  16. std::vector<std::string> languages;
  17. if (args.empty()) {
  18. this->SetError("called with incorrect number of arguments");
  19. return false;
  20. }
  21. for (std::vector<std::string>::const_iterator it = args.begin();
  22. it != args.end(); ++it) {
  23. if ((*it) == "OPTIONAL") {
  24. optional = true;
  25. } else {
  26. languages.push_back(*it);
  27. }
  28. }
  29. this->Makefile->EnableLanguage(languages, optional);
  30. return true;
  31. }