cmAddCustomTargetCommand.cxx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmAddCustomTargetCommand.h"
  14. // cmAddCustomTargetCommand
  15. bool cmAddCustomTargetCommand::InitialPass(std::vector<std::string> const& args)
  16. {
  17. bool all = false;
  18. if(args.size() < 2 )
  19. {
  20. this->SetError("called with incorrect number of arguments");
  21. return false;
  22. }
  23. // all target option
  24. std::string arguments;
  25. std::vector<std::string>::const_iterator s = args.begin();
  26. ++s; // move past args[0] as it is already to be used
  27. if (args.size() >= 2)
  28. {
  29. if (args[1] == "ALL")
  30. {
  31. all = true;
  32. ++s; // skip all
  33. }
  34. }
  35. std::string command;
  36. if(s != args.end())
  37. {
  38. command = *s;
  39. ++s;
  40. }
  41. for (;s != args.end(); ++s)
  42. {
  43. arguments += cmSystemTools::EscapeSpaces(s->c_str());
  44. arguments += " ";
  45. }
  46. m_Makefile->AddUtilityCommand(args[0].c_str(),
  47. command.c_str(),
  48. arguments.c_str(), all);
  49. return true;
  50. }