summaryrefslogtreecommitdiffstats
path: root/Source/cmAddTestCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-03-16 14:40:46 (GMT)
committerBrad King <brad.king@kitware.com>2009-03-16 14:40:46 (GMT)
commit66d69f864ae880f556debf02e66dee4855b0f2df (patch)
tree562a710c7c071a8dbfd83a15abd35e3a62ec4681 /Source/cmAddTestCommand.cxx
parente67f5138b80b3b04844f3f5c0a3c69796266f9e6 (diff)
downloadCMake-66d69f864ae880f556debf02e66dee4855b0f2df.zip
CMake-66d69f864ae880f556debf02e66dee4855b0f2df.tar.gz
CMake-66d69f864ae880f556debf02e66dee4855b0f2df.tar.bz2
ENH: Refactor generation of CTestTestfile content
This moves code which generates ADD_TEST and SET_TESTS_PROPERTIES calls into CTestTestfile.cmake files out of cmLocalGenerator and into a cmTestGenerator class. This will allow more advanced generation without cluttering cmLocalGenerator. The cmTestGenerator class derives from cmScriptGenerator to get support for per-configuration script generation (not yet enabled).
Diffstat (limited to 'Source/cmAddTestCommand.cxx')
-rw-r--r--Source/cmAddTestCommand.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 6124ee2..0bbf40e 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -16,6 +16,8 @@
=========================================================================*/
#include "cmAddTestCommand.h"
+#include "cmTestGenerator.h"
+
#include "cmTest.h"
@@ -42,7 +44,14 @@ bool cmAddTestCommand
arguments.push_back(*it);
}
- cmTest* test = this->Makefile->CreateTest(args[0].c_str());
+ // Create the test but add a generator only the first time it is
+ // seen. This preserves behavior from before test generators.
+ cmTest* test = this->Makefile->GetTest(args[0].c_str());
+ if(!test)
+ {
+ test = this->Makefile->CreateTest(args[0].c_str());
+ this->Makefile->AddTestGenerator(new cmTestGenerator(test));
+ }
test->SetCommand(args[1].c_str());
test->SetArguments(arguments);