added enable testing deprecated some commands

This commit is contained in:
Ken Martin
2001-06-06 13:58:18 -04:00
parent 355278324e
commit 37801ddaae
9 changed files with 266 additions and 115 deletions
+39 -4
View File
@@ -48,22 +48,57 @@ bool cmAddTestCommand::InitialPass(std::vector<std::string>& args)
// 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;
}
// store the aruments for the final pass
std::copy(args.begin(),args.end(),m_Args.begin());
return true;
}
// we append to the file in the final pass because Enable Testing command
// creates the file in the final pass.
void cmAddTestCommand::FinalPass()
{
// Expand any CMake variables
std::vector<std::string>::iterator s;
for (s = args.begin(); s != args.end(); ++s)
for (s = m_Args.begin(); s != m_Args.end(); ++s)
{
m_Makefile->ExpandVariablesInString(*s);
}
m_Makefile->AddTest(args);
// Create a full path filename for output Testfile
std::string fname;
fname = m_Makefile->GetStartOutputDirectory();
fname += "/";
fname += "CMakeTestfile.txt";
return true;
// Open the output Testfile
std::ofstream fout(fname.c_str());
if (!fout)
{
cmSystemTools::Error("Error Writing ", fname.c_str());
return;
}
std::vector<std::string>::iterator it;
// for each arg in the test
fout << "ADD_TEST(";
it = m_Args.begin();
fout << (*it).c_str();
++it;
for (; it != m_Args.end(); ++it)
{
fout << " " << (*it).c_str();
}
fout << ")" << std::endl;
fout.close();
return;
}