mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
added enable testing deprecated some commands
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user