2001-06-06 04:32:33 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
2001-06-06 04:32:33 +04:00
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
2001-06-06 04:32:33 +04:00
|
|
|
|
2002-01-21 23:30:43 +03:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
2001-06-06 04:32:33 +04:00
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#include "cmAddTestCommand.h"
|
|
|
|
|
2005-04-24 23:59:51 +04:00
|
|
|
#include "cmTest.h"
|
|
|
|
|
|
|
|
|
2001-06-06 04:32:33 +04:00
|
|
|
// cmExecutableCommand
|
2001-09-20 23:08:30 +04:00
|
|
|
bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args)
|
2001-06-06 04:32:33 +04:00
|
|
|
{
|
|
|
|
// First argument is the name of the test
|
|
|
|
// Second argument is the name of the executable to run (a target or external
|
|
|
|
// program)
|
|
|
|
// Remaining arguments are the arguments to pass to the executable
|
|
|
|
if(args.size() < 2 )
|
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
2001-06-06 21:58:18 +04:00
|
|
|
|
2001-06-07 00:14:11 +04:00
|
|
|
// store the arguments for the final pass
|
2002-02-26 19:46:01 +03:00
|
|
|
// also expand any CMake variables
|
|
|
|
|
2005-04-24 23:59:51 +04:00
|
|
|
std::vector<cmStdString> arguments;
|
2005-04-25 00:19:54 +04:00
|
|
|
std::vector<std::string>::const_iterator it;
|
|
|
|
for ( it = args.begin() + 2; it != args.end(); ++ it )
|
|
|
|
{
|
|
|
|
arguments.push_back(*it);
|
|
|
|
}
|
2001-06-06 21:58:18 +04:00
|
|
|
|
2005-04-24 23:59:51 +04:00
|
|
|
cmTest* test = m_Makefile->CreateTest(args[0].c_str());
|
|
|
|
test->SetCommand(args[1].c_str());
|
|
|
|
test->SetArguments(arguments);
|
2001-06-06 21:58:18 +04:00
|
|
|
|
2005-04-24 23:59:51 +04:00
|
|
|
return true;
|
2001-06-06 04:32:33 +04:00
|
|
|
}
|