summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Schroeder <will.schroeder@kitware.com>2001-01-12 17:43:00 (GMT)
committerWill Schroeder <will.schroeder@kitware.com>2001-01-12 17:43:00 (GMT)
commitb3480795c4fb890e8999fba580bb55a69fef1efb (patch)
tree5073ed51aa586fcd74333a603a73abb1ccb60941
parentca9099b551ad615a7368c0f71a7aa8fc3bc0c307 (diff)
downloadCMake-b3480795c4fb890e8999fba580bb55a69fef1efb.zip
CMake-b3480795c4fb890e8999fba580bb55a69fef1efb.tar.gz
CMake-b3480795c4fb890e8999fba580bb55a69fef1efb.tar.bz2
ENH:Simple program dumps out internal documentation for CMake
-rw-r--r--Source/cmDumpDocumentation.cxx12
-rw-r--r--Source/cmMakefile.cxx31
-rw-r--r--Source/cmMakefile.h6
3 files changed, 49 insertions, 0 deletions
diff --git a/Source/cmDumpDocumentation.cxx b/Source/cmDumpDocumentation.cxx
new file mode 100644
index 0000000..7034e03
--- /dev/null
+++ b/Source/cmDumpDocumentation.cxx
@@ -0,0 +1,12 @@
+// Program extracts documentation describing rules from
+// the CMake system.
+//
+#include "cmMakefile.h"
+
+int main()
+{
+ cmMakefile makefile;
+ makefile.DumpDocumentationToFile("cmake.txt");
+
+ return 0;
+}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 05ed4d6..59f87c0 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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;
+}
+
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 001ba4a..6a444b4 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -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;