diff options
author | Amitha Perera <perera@cs.rpi.edu> | 2001-08-23 18:30:05 -0400 |
---|---|---|
committer | Amitha Perera <perera@cs.rpi.edu> | 2001-08-23 18:30:05 -0400 |
commit | 2eb9d09e04735163a4c5d66e789ff9b6e60e0220 (patch) | |
tree | 874633211f1b83e6ab7f23b796a0b230cf6ca6bb /Source/cmAddTestCommand.cxx | |
parent | 538ff79e2f606c4c3722d94e10f0a759a1f97d86 (diff) | |
download | cmake-2eb9d09e04735163a4c5d66e789ff9b6e60e0220.tar.gz |
BUG: ADD_TEST now only does stuff if ENABLE_TESTING has been run.
Diffstat (limited to 'Source/cmAddTestCommand.cxx')
-rw-r--r-- | Source/cmAddTestCommand.cxx | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx index 2f06b4fb54..e7d16b4a05 100644 --- a/Source/cmAddTestCommand.cxx +++ b/Source/cmAddTestCommand.cxx @@ -78,28 +78,32 @@ void cmAddTestCommand::FinalPass() fname += "/"; fname += "DartTestfile.txt"; - // Open the output Testfile - std::ofstream fout(fname.c_str(), std::ios::app); - if (!fout) + + // If the file doesn't exist, then ENABLE_TESTING hasn't been run + if (cmSystemTools::FileExists(fname.c_str())) { - cmSystemTools::Error("Error Writing ", fname.c_str()); - return; - } + // Open the output Testfile + std::ofstream fout(fname.c_str(), std::ios::app); + if (!fout) + { + cmSystemTools::Error("Error Writing ", fname.c_str()); + return; + } - std::vector<std::string>::iterator it; + 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(); - + 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; } |