summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestScriptHandler.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-06-12 14:56:40 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-06-12 14:56:40 (GMT)
commit6e28861c188316ead00c750cb71b130237179812 (patch)
tree428846ab608075cf053082dac91b6210ec7f3ec0 /Source/CTest/cmCTestScriptHandler.cxx
parentc64447c3686e22389c406fe987271149150dd93d (diff)
downloadCMake-6e28861c188316ead00c750cb71b130237179812.zip
CMake-6e28861c188316ead00c750cb71b130237179812.tar.gz
CMake-6e28861c188316ead00c750cb71b130237179812.tar.bz2
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
Diffstat (limited to 'Source/CTest/cmCTestScriptHandler.cxx')
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index e8d4029..da7e7c5 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -301,6 +301,27 @@ void cmCTestScriptHandler::CreateCMake()
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