[CMake] Getting a list of the defined CMake cache variables along with properties and documentation?

Bill Hoffman bill.hoffman at kitware.com
Wed Dec 3 21:44:19 EST 2008


Bartlett, Roscoe A wrote:
> Hello,
>  
> Is there a way in a CMakeLists.txt file to get a list of all of the 
> defined CMake cache variables, get their properties, and their 
> documentation?  I would like to have this so that I can build more 
> general documentation for our CMake project.  I could of course just 
> parse the CMakeCache.txt file myself but if there is a way to do this in 
> CMake then that might be better.  Otherwise, I will need to create a 
> tool that would do a configure, then read the CMakeCache.txt file and 
> build documentation output like you would see for our current autotools 
> build system.
>  

There is no such tool.  There are also problems with such a tool.  The 
main problem is the if statement.  To get complete docs for a project 
you would have to evaluate each if both true and false to make sure you 
found all possible cache values for a project.   It has come up on the 
list a few times, but no general solution has been discovered.

-Bill


More information about the CMake mailing list