cmEnableLanguageCommand.cxx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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
  13. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  14. {
  15. bool optional = false;
  16. std::vector<std::string> languages;
  17. if(args.size() < 1 )
  18. {
  19. this->SetError
  20. ("called with incorrect number of arguments");
  21. return false;
  22. }
  23. for (std::vector<std::string>::const_iterator it = args.begin();
  24. it != args.end();
  25. ++it)
  26. {
  27. if ((*it) == "OPTIONAL")
  28. {
  29. optional = true;
  30. }
  31. else
  32. {
  33. languages.push_back(*it);
  34. }
  35. }
  36. this->Makefile->EnableLanguage(languages, optional);
  37. return true;
  38. }