Here is the closest I could get. The following has been tested with CMake 2.8.10. CMake 3.0 is under development and will receive a new documentation system based on Sphinx and reStructuredText . I assume this will lead to new ways of documenting your modules.
CMake 2.8 can extract documentation from your modules, but only the documentation at the beginning of the file is considered. All documentation is added as CMake comments, starting with one # . Double ## will be ignored (so you can add comments to your documentation). The end of the documentation is marked with the first line without comment (for example, an empty line)
The first line gives a brief description of the module. It should begin with - and end with a period . or an empty string.
# - My first documented CMake module. # description
or # - My first documented module CMake # # description
In HTML, lines starting with two or more spaces (after # ) are formatted with a monospace font.
Example:
# - My custom macros to do foo
To create documentation for your custom modules only, call
cmake -DCMAKE_MODULE_PATH:STRING=. --help-custom-modules test.html
The CMAKE_MODULE_PATH allows you to define additional directories to search for modules. Otherwise, your modules should be in the default CMake location. --help-custom-modules restricts documentation to regular, non-CMake-standard modules. If you specify a file name, the documentation will be written to the file, otherwise stdout. If the file name has a recognized extension, the documentation is formatted accordingly.
The following formats are possible:
.html for HTML documentation.1 to .9 for man page.docbook for Docbook- everything else: plain text
source share