[CMake] Visualizing all build-system options

David Cole david.cole at kitware.com
Thu Sep 1 18:00:10 EDT 2011


Sounds like a great research project for somebody. Would be cool to
see CMake options visualized for some larger projects...

Not sure of its feasibility in terms of completeness, however. I'm
sure you could come up with something rudimentary that seems to work
for some cases.

There are some cases that you will simply never reach, even though the
code is in there.

For example, consider what happens when you have this code:

if(WIN32)
  option(SOME_WIN32_SPECIFIC_OPTION ...)
endif()

And then you run your tool on your Linux box. I don't care how many
iterations you do, you're simply never going to see the platform
specific option.

Also, in order to aim for completeness, you'd need to deal with
potential code like this:

if(optA AND optB AND optC AND optD OR NOT (optE AND optF))
  option(REALLY_WELL_HIDDEN_OPTION ...)
endif()

Basically, the "inner" option will only be triggered in a very
specific set of true-false values of all the "outer" options...

The combinatorial nature of the arbitrary logic enabled by the IF
command makes it very difficult for an analysis tool like this to
achieve "guaranteed completeness."

However, even without completeness, it would still be a neat tool, and
I'd love to see what sorts of graphs are out there in the wild.


- 2 cents worth... :-)

David C.


On Thu, Sep 1, 2011 at 5:38 AM, Alan W. Irwin <irwin at beluga.phys.uvic.ca> wrote:
> I was just replying to an acquaintance who was e-mailing me about CMake
> configuration when I realized that CMake configuration options
> which are only available depending on how other configuration
> options are set could be analyzed/displayed using graph theory
> (from a 5-minute study of graph theory from reading the first
> paragraph of the Wikipedia article on that :-) ).
>
> I looked for a graphviz output file option for this in the cmake
> documentation and only found the --graphviz option which will
> "Generate a graphviz input file that will contain all the library and
> executable dependencies in the project." I used that for PLplot once.
> It worked and gave a pretty impressive visual demonstration of all the
> complicated and numerous PLplot dependencies.  I wasn't surprised by
> any of those detailed relationships because I have them pretty much
> memorized, but such information would be a definite help to someone
> just getting up to speed with the PLplot build system (or any
> CMake-based build system)
>
> Could something similar be done for the dependencies between CMake
> options?  I think that would be quite useful (especially if it
> included the documentation of the options) for further graphviz
> analysis and display of the
> relationships between the totality of all the CMake options for a
> given build system.  The problem with using cmake-gui for this task
> (or the equivalent cmake + looking at the resulting CMakeCache.txt
> file) is you only see the first layer of possible configurations as
> opposed to the totality of options you could visualize with a graphviz
> file.
>
> Moving to a related topic, if you run cmake with no -D options in an
> empty build tree, you get the first layer of options available to you
> for a particular build system in nicely documented form in
> CMakeCache.txt.  Once you set some of those as cmake -D options
> (always run within an empty build tree), then you get the next layer
> of options available to you, and so on, with each iteration
> accumulating the command-line -D options you need from the combination
> of previous sets of options and the new ones.
>
> I am not familiar with the CMake GUI's, cmake-gui and ccmake, but I
> assume they do exactly this same task of displaying the documented
> currently available options that can be set depending on the previous
> "layer" of set options.  But do any of these GUI's have an undo button
> (and redo button to undo the undo) so you can easily and consistently
> navigate to any previous layer of options that you have effectively
> tried before for an empty build tree like you can so easily do (simply
> using up arrow or down arrow to remove the build tree and navigate to
> some other previously tried set of -D options) with the command-line
> approach?  It appears from discussions with my GUI-oriented
> acquaintance, undo and redo buttons would be worthwhile now if those
> haven't been implemented yet in the CMake GUI's.
>
> I hope in this post I have given this audience some useful food for
> thought about potential improvements to CMake concerning (1) a
> graphviz output file of all options including their documentation to
> help display an overview of all options and their logical
> relationships and (2) possibly additional ease of use for CMake GUI's
> with undo and redo (if those haven't been implemented yet) in setting
> various layers of those options that become available depending on
> other options set in previous layers. I admit to being unfamiliar with
> the CMake GUI's (because I was not impressed with them years ago), but
> if they already have undo and redo implemented perhaps it is time to
> learn about them (and especially if they are exactly equivalent to the
> situation I understand which is running cmake in an empty build tree
> with various layers of possible -D options set on the cmake command
> line).
>
> Alan
> __________________________
> Alan W. Irwin
>
> Astronomical research affiliation with Department of Physics and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
>
> Programming affiliations with the FreeEOS equation-of-state
> implementation for stellar interiors (freeeos.sf.net); the Time
> Ephemerides project (timeephem.sf.net); PLplot scientific plotting
> software package (plplot.sf.net); the libLASi project
> (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
> and the Linux Brochure Project (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list