[CMake] Documenting CMakeLists.txt and custom or local .cmake files

Philip Miller philip.miller at sri.com
Wed Apr 6 22:51:56 EDT 2016


Two days ago I posted this question on StackOverflow, http://stackoverflow.com/q/36415261/3154588. I have not gotten an answer there, so I thought I would ask on this list. 

What are good ways to document my project ``CMakeLists.txt`` files and local project ``.cmake`` files? There is a two year old question/answer http://stackoverflow.com/q/21628833/3154588 that I am essentially asking here again. The answer contains the statement 

> Currently, CMake 3.0 is under development which will get a new documentation system based on Sphinx and reStructuredText. I guess that this will bring new ways to document your modules.

I have looked at the [cmake developer documentation](https://cmake.org/cmake/help/v3.5/manual/cmake-developer.7.html?highlight=sphinx#id2), but this *new documentation system* seems geared towards the documentation of cmake itself. I do not see how I can use this to document my user-defined project ``CMakeLists.txt`` files or local ``.cmake`` files. 

I am hoping that since the cmake project internally has various sphinx directives and roles that there is was some way as a user I could take advantage of this internal usage of sphinx. I would like to be able to have some *markup* in my ``CMakeLists.txt`` files and local ``.cmake`` files without having to reinvent the wheel. There are related efforts in other projects. For example the ROS catkin project seems to offer the most complete approach that I have seen, but that is fairly heavyweight not easy to use for non-ROS projects. (As an example, look at their [extracted cmake api page](http://docs.ros.org/api/catkin/html/dev_guide/generated_cmake_api.html).) The simplest, is the [sphinx-contrib](https://bitbucket.org/birkenfeld/sphinx-contrib/) cmakedomain, but that relies on a separate rst source doc rather than an *autodoc* approach with markup comments. 

I appreciate any help.
Sincerely,
Phil


More information about the CMake mailing list