cmAddTestCommand.cxx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 "cmAddTestCommand.h"
  14. #include "cmTest.h"
  15. // cmExecutableCommand
  16. bool cmAddTestCommand
  17. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  18. {
  19. // First argument is the name of the test Second argument is the name of
  20. // the executable to run (a target or external program) Remaining arguments
  21. // are the arguments to pass to the executable
  22. if(args.size() < 2 )
  23. {
  24. this->SetError("called with incorrect number of arguments");
  25. return false;
  26. }
  27. // store the arguments for the final pass
  28. // also expand any CMake variables
  29. std::vector<cmStdString> arguments;
  30. std::vector<std::string>::const_iterator it;
  31. for ( it = args.begin() + 2; it != args.end(); ++ it )
  32. {
  33. arguments.push_back(*it);
  34. }
  35. cmTest* test = this->Makefile->CreateTest(args[0].c_str());
  36. test->SetCommand(args[1].c_str());
  37. test->SetArguments(arguments);
  38. return true;
  39. }