[cmake-commits] alex committed cmCTestScriptHandler.cxx 1.38 1.39

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Jun 12 10:56:42 EDT 2007


Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv7458/CTest

Modified Files:
	cmCTestScriptHandler.cxx 
Log Message:

ENH: remove non/scriptable cmake commands from the script handler in ctest,
as discussed with David. This also gives a better ctest man page with just
the commands you should actually use in ctest scripts.
Until now these commands were more or less executed, but e.g. add_executable() didn't create an executable, project() failed with an
error. Now you get an error instantly if using one of these commands.

Alex


Index: cmCTestScriptHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestScriptHandler.cxx,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- cmCTestScriptHandler.cxx	8 Jun 2007 20:06:33 -0000	1.38
+++ cmCTestScriptHandler.cxx	12 Jun 2007 14:56:40 -0000	1.39
@@ -301,6 +301,27 @@
   this->LocalGenerator->SetGlobalGenerator(this->GlobalGenerator);
   this->Makefile = this->LocalGenerator->GetMakefile();
 
+  // remove all cmake commands which are not scriptable, since they can't be 
+  // used in ctest scripts
+  std::vector<std::string> unscriptableCommands;
+  cmake::RegisteredCommandsMap* commands = this->CMake->GetCommands();
+  for (cmake::RegisteredCommandsMap::const_iterator pos = commands->begin();
+       pos != commands->end();
+       ++pos)
+    {
+    if (!pos->second->IsScriptable())
+      {
+      unscriptableCommands.push_back(pos->first);
+      }
+    }
+
+  for(std::vector<std::string>::const_iterator it=unscriptableCommands.begin();
+      it != unscriptableCommands.end();
+      ++it)
+    {
+//    fprintf(stderr, "Removing %s\n", it->c_str());
+    this->CMake->RemoveCommand(it->c_str());
+    }
 
   // add any ctest specific commands, probably should have common superclass
   // for ctest commands to clean this up. If a couple more commands are



More information about the Cmake-commits mailing list