summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-06-08 20:06:33 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-06-08 20:06:33 (GMT)
commite37f8e2964e8415892eb31dce4c462173e95f69f (patch)
tree71aa497bb50233407b22d7c318aee1b18285c815 /Source
parentd1c4a0bf9ee0851a576aea6af72b20222144f830 (diff)
downloadCMake-e37f8e2964e8415892eb31dce4c462173e95f69f.zip
CMake-e37f8e2964e8415892eb31dce4c462173e95f69f.tar.gz
CMake-e37f8e2964e8415892eb31dce4c462173e95f69f.tar.bz2
STYLE: create command documentation for ctest
I think some of the cmake commands should be removed from ctest if possible, like add_executable etc. Alex
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx73
-rw-r--r--Source/CTest/cmCTestScriptHandler.h3
-rw-r--r--Source/cmDocumentation.cxx31
-rw-r--r--Source/ctest.cxx8
4 files changed, 70 insertions, 45 deletions
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 0346e43..e8d4029 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -283,6 +283,46 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
return retVal;
}
+void cmCTestScriptHandler::CreateCMake()
+{
+ // create a cmake instance to read the configuration script
+ if (this->CMake)
+ {
+ delete this->CMake;
+ delete this->GlobalGenerator;
+ delete this->LocalGenerator;
+ }
+ this->CMake = new cmake;
+ this->CMake->AddCMakePaths(this->CTest->GetCTestExecutable());
+ this->GlobalGenerator = new cmGlobalGenerator;
+ this->GlobalGenerator->SetCMakeInstance(this->CMake);
+
+ this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator();
+ this->LocalGenerator->SetGlobalGenerator(this->GlobalGenerator);
+ this->Makefile = this->LocalGenerator->GetMakefile();
+
+
+ // add any ctest specific commands, probably should have common superclass
+ // for ctest commands to clean this up. If a couple more commands are
+ // created with the same format lets do that - ken
+ this->AddCTestCommand(new cmCTestBuildCommand);
+ this->AddCTestCommand(new cmCTestConfigureCommand);
+ this->AddCTestCommand(new cmCTestCoverageCommand);
+ this->AddCTestCommand(new cmCTestEmptyBinaryDirectoryCommand);
+ this->AddCTestCommand(new cmCTestMemCheckCommand);
+ this->AddCTestCommand(new cmCTestReadCustomFilesCommand);
+ this->AddCTestCommand(new cmCTestRunScriptCommand);
+ this->AddCTestCommand(new cmCTestSleepCommand);
+ this->AddCTestCommand(new cmCTestStartCommand);
+ this->AddCTestCommand(new cmCTestSubmitCommand);
+ this->AddCTestCommand(new cmCTestTestCommand);
+ this->AddCTestCommand(new cmCTestUpdateCommand);
+}
+
+void cmCTestScriptHandler::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v) const
+{
+ this->CMake->GetCommandDocumentation(v);
+}
//----------------------------------------------------------------------
// this sets up some variables for the script to use, creates the required
@@ -307,22 +347,9 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
return 1;
}
- // create a cmake instance to read the configuration script
// read in the list file to fill the cache
- if (this->CMake)
- {
- delete this->CMake;
- delete this->GlobalGenerator;
- delete this->LocalGenerator;
- }
- this->CMake = new cmake;
- this->CMake->AddCMakePaths(this->CTest->GetCTestExecutable());
- this->GlobalGenerator = new cmGlobalGenerator;
- this->GlobalGenerator->SetCMakeInstance(this->CMake);
-
- this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator();
- this->LocalGenerator->SetGlobalGenerator(this->GlobalGenerator);
- this->Makefile = this->LocalGenerator->GetMakefile();
+ // create a cmake instance to read the configuration script
+ this->CreateCMake();
// set a variable with the path to the current script
this->Makefile->AddDefinition("CTEST_SCRIPT_DIRECTORY",
@@ -336,22 +363,6 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", true);
this->UpdateElapsedTime();
- // add any ctest specific commands, probably should have common superclass
- // for ctest commands to clean this up. If a couple more commands are
- // created with the same format lets do that - ken
- this->AddCTestCommand(new cmCTestBuildCommand);
- this->AddCTestCommand(new cmCTestConfigureCommand);
- this->AddCTestCommand(new cmCTestCoverageCommand);
- this->AddCTestCommand(new cmCTestEmptyBinaryDirectoryCommand);
- this->AddCTestCommand(new cmCTestMemCheckCommand);
- this->AddCTestCommand(new cmCTestReadCustomFilesCommand);
- this->AddCTestCommand(new cmCTestRunScriptCommand);
- this->AddCTestCommand(new cmCTestSleepCommand);
- this->AddCTestCommand(new cmCTestStartCommand);
- this->AddCTestCommand(new cmCTestSubmitCommand);
- this->AddCTestCommand(new cmCTestTestCommand);
- this->AddCTestCommand(new cmCTestUpdateCommand);
-
// add the script arg if defined
if (script_arg.size())
{
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index f82f3ea..d410c4e 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -108,6 +108,9 @@ public:
void Initialize();
+ void CreateCMake();
+ void GetCommandDocumentation(std::vector<cmDocumentationEntry>& v) const;
+
private:
// reads in a script
int ReadInScript(const std::string& total_script_arg);
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 12c451a..16ae84b 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -301,28 +301,31 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::CreateModulesSection()
{
- this->ModulesSection.Append(cmDocumentationModulesHeader[0]);
std::string cmakeModules = this->CMakeRoot;
cmakeModules += "/Modules";
cmsys::Directory dir;
dir.Load(cmakeModules.c_str());
- for(unsigned int i = 0; i < dir.GetNumberOfFiles(); ++i)
+ if (dir.GetNumberOfFiles() > 0)
{
- std::string fname = dir.GetFile(i);
- if(fname.length() > 6)
+ this->ModulesSection.Append(cmDocumentationModulesHeader[0]);
+ for(unsigned int i = 0; i < dir.GetNumberOfFiles(); ++i)
{
- if(fname.substr(fname.length()-6, 6) == ".cmake")
+ std::string fname = dir.GetFile(i);
+ if(fname.length() > 6)
{
- std::string moduleName = fname.substr(0, fname.length()-6);
- std::string path = cmakeModules;
- path += "/";
- path += fname;
- this->CreateSingleModule(path.c_str(), moduleName.c_str());
+ if(fname.substr(fname.length()-6, 6) == ".cmake")
+ {
+ std::string moduleName = fname.substr(0, fname.length()-6);
+ std::string path = cmakeModules;
+ path += "/";
+ path += fname;
+ this->CreateSingleModule(path.c_str(), moduleName.c_str());
+ }
}
- }
- }
- cmDocumentationEntry e = { 0, 0, 0 };
- this->ModulesSection.Append(e);
+ }
+ cmDocumentationEntry e = { 0, 0, 0 };
+ this->ModulesSection.Append(e);
+ }
return true;
}
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 346977c..b7d207f 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -21,6 +21,7 @@
#include "cmake.h"
#include "cmDocumentation.h"
+#include "CTest/cmCTestScriptHandler.h"
//----------------------------------------------------------------------------
static const cmDocumentationEntry cmDocumentationName[] =
@@ -236,11 +237,18 @@ int main (int argc, char *argv[])
if(doc.CheckOptions(argc, argv) || nocwd)
{
// Construct and print requested documentation.
+ std::vector<cmDocumentationEntry> commands;
+ cmCTestScriptHandler* ch =
+ static_cast<cmCTestScriptHandler*>(inst.GetHandler("script"));
+ ch->CreateCMake();
+ ch->GetCommandDocumentation(commands);
+
doc.SetName("ctest");
doc.SetNameSection(cmDocumentationName);
doc.SetUsageSection(cmDocumentationUsage);
doc.SetDescriptionSection(cmDocumentationDescription);
doc.SetOptionsSection(cmDocumentationOptions);
+ doc.SetCommandsSection(&commands[0]);
doc.SetSeeAlsoList(cmDocumentationSeeAlso);
#ifdef cout
# undef cout