summaryrefslogtreecommitdiffstats
path: root/Source/cmAddTestCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2001-06-06 17:58:18 (GMT)
committerKen Martin <ken.martin@kitware.com>2001-06-06 17:58:18 (GMT)
commit37801ddaaec78597d5ac000bf60f6948ff865d06 (patch)
treea39ab5ff5c125d6e2c5dfb4235cf041518fbd266 /Source/cmAddTestCommand.cxx
parent355278324e0e96048e27195249161c1c68a7c412 (diff)
downloadCMake-37801ddaaec78597d5ac000bf60f6948ff865d06.zip
CMake-37801ddaaec78597d5ac000bf60f6948ff865d06.tar.gz
CMake-37801ddaaec78597d5ac000bf60f6948ff865d06.tar.bz2
added enable testing deprecated some commands
Diffstat (limited to 'Source/cmAddTestCommand.cxx')
-rw-r--r--Source/cmAddTestCommand.cxx43
1 files changed, 39 insertions, 4 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 4e76b07..1c12b32 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -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;
}