ENH: keep cleaning up Tcl/Tk modules
[cmake.git] / Source / cmAddTestCommand.cxx
blob0cc0d76851f6c0d08f47cc09bdfb9b09154ad6ea
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmAddTestCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.29 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmAddTestCommand.h"
19 #include "cmTest.h"
22 // cmExecutableCommand
23 bool cmAddTestCommand
24 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
26 // First argument is the name of the test Second argument is the name of
27 // the executable to run (a target or external program) Remaining arguments
28 // are the arguments to pass to the executable
29 if(args.size() < 2 )
31 this->SetError("called with incorrect number of arguments");
32 return false;
35 // store the arguments for the final pass
36 // also expand any CMake variables
38 std::vector<cmStdString> arguments;
39 std::vector<std::string>::const_iterator it;
40 for ( it = args.begin() + 2; it != args.end(); ++ it )
42 arguments.push_back(*it);
45 cmTest* test = this->Makefile->CreateTest(args[0].c_str());
46 test->SetCommand(args[1].c_str());
47 test->SetArguments(arguments);
49 return true;