Re: [CMake] Getting a list of the defined CMake cache variables along with properties and documentation?
Philip Lowman wrote: 1. A chicken and the egg problem, a configure has to occur and CMakeCache.txt created first before you can even parse it for documentation. Depending on the system being configured generation of a CMakeCache.txt can take some time due to all of the time needed to do compilation checks, etc. It's not as if the user is going to be able to run cmake --configure-help . and have it immediately spit out documentation like GNU AutoTools prior to the user even configuring the build. There would have to be an initial delay as the cache is created. Obviously there is the apriori option here though (distribute configuration help ahead of time or require the user to configure manually first). 2. The generated documentation (as Bill alluded to) would be dependent on which branches were taken during the configure Every time we talk about this, I think the only way to solve it is to have all the options in some central place. Basically add some sort of argv/argc handler code into CMake. It would be up to the project maintainer to put the publishable options into that file. Any sort of code that makes all if statement branches true will just not work, and will be a huge hack. Something like: ProjectOptions.cmake add_option(enable-testing Enable the testing part of the project ENABLE_TESTING) add_option(build-with-mpi Use MPI with this project BUILD_WITH_MPI) The option would have a command line option, the documentation, and the cache variable. A documentation feature could search the project source tree for PRojectOptions.cmake files and quickly find them all. -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Getting a list of the defined CMake cache variables along with properties and documentation?
On Thursday 04 December 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. If you want documentation for your custom cmake modules, this is possible. You can run cmake with the --help-custom-modules argument and it will generate the documentation for your custom cmake modules. You just have to tell cmake where they are: $ cmake -DCMAKE_MODULE_PATH=/opt/kdelibs/share/apps/cmake/modules\ --help-custom-modules Alex ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Getting a list of the defined CMake cache variables along with properties and documentation?
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. Thanks, - Ross - Dr. Roscoe A. Bartlett Senior Member of the Technical Staff Trilinos Software Engineering Technologies and Integration Lead Sandia National Laboratories Phone: (505) 275-6147 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Getting a list of the defined CMake cache variables along with properties and documentation?
On Wed, Dec 3, 2008 at 9:44 PM, Bill Hoffman [EMAIL PROTECTED]wrote: 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 imes, but no general solution has been discovered. There is also the problem of what to do with all of the cache variables you wouldn't want in your documentation. And also what to do when you aren't happy with the docstring provided by the maintainer of FindFoo.cmake and want to override it with your own (perhaps to explain the effect of having or not having FOO_LIBRARY on your project if it's an optional dependency). That being said, it probably still would be a useful feature even if it doesn't overcome the if/else issue the first go-around. Many people would probably be OK with this limitation. Incidentally, I don't think the if() else() issue would be that hard to solve once you had a basic cache documentation generator implemented. At least there would be more of an incentive to fix this use case then. :) The simple (probably naive) approach would seem to be to just set cmIfFunctionBlocker::isBlocking always to false when the cache documentation generator is running, and see what happens. Not sure if this would work correctly or not and result in all branches being taken, but it probably would be a good start. It seems to me the hard part would be disabling all of the harmful CMake commands you wouldn't want to run while generating the documentation . And getting CMake to not save everything to the cache, and all of the other crazy stuff you wouldn't want it to do while trying to detect cache variables. (A new virtual hook on cmCommand similar to InvokeInitialPass() that gets run in the special generation mode which would either simply return or call InvokeInitialPass() would probably be a good start). Obviously a CMakeCache.txt file parser might be quicker to implement but it would have at least these drawbacks: 1. A chicken and the egg problem, a configure has to occur and CMakeCache.txt created first before you can even parse it for documentation. Depending on the system being configured generation of a CMakeCache.txt can take some time due to all of the time needed to do compilation checks, etc. It's not as if the user is going to be able to run cmake --configure-help . and have it immediately spit out documentation like GNU AutoTools prior to the user even configuring the build. There would have to be an initial delay as the cache is created. Obviously there is the apriori option here though (distribute configuration help ahead of time or require the user to configure manually first). 2. The generated documentation (as Bill alluded to) would be dependent on which branches were taken during the configure -- Philip Lowman ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake