BUG: ADD_TEST now only does stuff if ENABLE_TESTING has been run.

This commit is contained in:
Amitha Perera 2001-08-23 18:30:05 -04:00
parent 538ff79e2f
commit 2eb9d09e04
2 changed files with 26 additions and 20 deletions

View File

@ -78,6 +78,10 @@ void cmAddTestCommand::FinalPass()
fname += "/"; fname += "/";
fname += "DartTestfile.txt"; fname += "DartTestfile.txt";
// If the file doesn't exist, then ENABLE_TESTING hasn't been run
if (cmSystemTools::FileExists(fname.c_str()))
{
// Open the output Testfile // Open the output Testfile
std::ofstream fout(fname.c_str(), std::ios::app); std::ofstream fout(fname.c_str(), std::ios::app);
if (!fout) if (!fout)
@ -99,7 +103,7 @@ void cmAddTestCommand::FinalPass()
} }
fout << ")" << std::endl; fout << ")" << std::endl;
fout.close(); fout.close();
}
return; return;
} }

View File

@ -92,7 +92,9 @@ public:
{ {
return return
"ADD_TEST(testname exename arg1 arg2 arg3 ...)\n" "ADD_TEST(testname exename arg1 arg2 arg3 ...)\n"
"This command adds a test target to the current directory. " "If the ENABLE_TESTING command has been run, this command adds a"
"test target to the current directory. If ENABLE_TESTING has not"
"been run, this command does nothing.\n"
"The tests are run by the testing subsystem by executing exename " "The tests are run by the testing subsystem by executing exename "
"with the specified arguments. exename can be either an executable " "with the specified arguments. exename can be either an executable "
"built by built by this project or an arbitrary executable on the " "built by built by this project or an arbitrary executable on the "