Allow alphabetic sorting of cache variables to be disabled or allow custom explicit ordering of entries
I'm using CMake as a configuration tool and build generator for an embedded C++ RTOS (http://distortos.org/ - CMake support is available only in the development version from the repository). This project has quite a lot of options and quite frequently these options are dependent on each other or highly related. Take for an example chip clock configuration, where enabling PLL reveals options for this PLL (source selection, multipliers, dividers), and also allows "PLL" to be selected as a "source of clock" for other options. In such scenario it is a very valuable feature to have the options grouped together and presented in the logical order - for example option to enable PLL precedes the options which configure this PLL and options which can use this PLL as a source, PLL parameters (multipliers and dividers) are presented in their "physical" order and so on. This is where the problem is - cmake-gui, cmake -LAH
and ccmake all insist on presenting cache variables in alphabetic order, while for me it would be much better if they would be presented in the order they were created with set(... CACHE ...)
command or if there was a way to somehow arrange them into ordered groups (I know I can group the options by their prefix, but this does not solve the issue at all). For now I "solved" this issue by adding an increasing counter to the names of the options - see screenshot.
However this is far from being ideal:
- (minor) some numbers are missing, because some options are not available because of selected chip or values of other options, which is confusing,
- (major) whenever I need to add some option between existing options, I have to change the numbering of all following variables from this group, which breaks user's configuration - now there are duplicated options with different numbers, where half of them serves no purpose.
I'm opening this issue to hopefully start a discussion about solutions to this problem - maybe I'm not the only one facing it. Previously my project was using kconfig-frontends (a tool used to configure Linux kernel), and in there the options and menus were presented in the order of creation, which I think would be the easiest approach in CMake too.