Simon Walker
Simon Walker

Reputation: 5981

Creating groups of CMake options

I am using CMake to manage a build of a collection of projects on Linux, not a single project but the principle is the same. Each project has its own collection of options, for example DEVEL switches and custom code to be included. These are added in the standard CMake way:

OPTION(NAME "Helpstring" VALUE)

I am looking for a way to group these options based on which project they belong to as currently they are placed in alphabetical order and could be quite confusing. It would also save me coming up with unique names for each option, for example a DEVEL option could apply for all of the projects, but I might only want to enable it on some. I do not want to write e.g. PROJECTNAME_DEVEL options.

Ideally I would like a system to divide the options based on project, e.g.

PROJECT1NAME:
    DEVEL: ON
PROJECT2NAME:
    DEVEL: OFF
    ANOTHER_OPTION: ON

Can I do this somehow? I am primarily aiming this at the ncurses interface to cmake, I see that the Qt interface can group entries, so is this possible in the ncurses interface?

Cheers

Upvotes: 6

Views: 6112

Answers (1)

DLRdave
DLRdave

Reputation: 14240

Both commenters are correct here: the cmake-gui program (the Qt-based gui) groups options together based on leading prefix up to the first underscore character.

The ccmake program (the ncurses-based "gui") does not have the same grouping capability yet.

Upvotes: 4

Related Questions