Commit b3480795 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH:Simple program dumps out internal documentation for CMake

parent ca9099b5
// Program extracts documentation describing rules from
// the CMake system.
//
#include "cmMakefile.h"
int main()
{
cmMakefile makefile;
makefile.DumpDocumentationToFile("cmake.txt");
return 0;
}
......@@ -372,3 +372,34 @@ const char* cmMakefile::GetDefinition(const char* name)
}
return 0;
}
int cmMakefile::DumpDocumentationToFile(const char *fileName)
{
// Open the supplied filename
std::ofstream f;
f.open(fileName, std::ios::out);
if ( f.fail() )
{
return 0;
}
// Loop over all registered rules and print out documentation
const char *name;
const char *terse;
const char *full;
for(StringRuleMakerMap::iterator j = m_RuleMakers.begin();
j != m_RuleMakers.end(); ++j)
{
name = (*j).second->GetName();
terse = (*j).second->TerseDocumentation();
full = (*j).second->FullDocumentation();
f << name << " - " << terse << std::endl
<< "\t" << full << std::endl << std::endl;
}
return 1;
}
......@@ -300,6 +300,12 @@ public:
const char* GetDefineFlags()
{return m_DefineFlags.c_str();}
/**
* Dump documentation to a file. If 0 is returned, the
* operation failed.
*/
int DumpDocumentationToFile(const char *fileName);
protected:
bool m_Executables;
std::string m_Prefix;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment