The DEBUG_CONFIGURATIONS property doesn’t appear to be initialized by default.
The docs for it do say
This property must be set at the top level of the project and before the first target_link_libraries() command invocation
But considering the fact that other configuration-related things like CMAKE_BUILD_TYPE and CMAKE_CONFIGURATION_TYPES have defaults, wouldn’t it make sense for this property to, as well? It seems like a very easy thing for projects to miss.
While I’m thinking about build types/configurations, it might be nice to have a
define_build_configuration command, to associate doc strings with project-defined build types, and perhaps the CMake GUI could offer a drop-down chooser…
Some of this is already possible. The
set_property() command allows you to indicate a list of values for a cache variable. For example:
set(trafficLight Green CACHE STRING "Status of something")
set_property(CACHE trafficLight PROPERTY STRINGS Red Orange Green)
In the CMake GUI, the
trafficLight cache variable will then show with a combo box of the choices
Green. Some IDEs do something similar (e.g. VS Code and Qt Creator do, with some quirks).
Note that the above is not enforced as a constraint. You can still set the variable to any value you like on the command line and nothing in CMake will complain. The
STRINGS property is purely for giving UIs some information, should they choose to make use of it.