Constraining Values with ComboBoxes in CMake (cmake-gui)

320 views Asked by At

I encountered CMake project where cache entry in cmake-gui was presented as combobox. But I can't find this project. How to add cache entry to CMakeLists.txt with values constrained with combobox?

1

There are 1 answers

0
stardust On BEST ANSWER

You can set the a variable to a default value and add it to the cache.

set(COLOR_MODE "always" CACHE STRING "Should we use colors")

Then you can set the property for the variable to the list of values you want to appear in the combobox.

set_property(CACHE COLOR_MODE PROPERTY STRINGS always auto never)