The input variables shown in all CMake UIs are cache variables. You can create your own using set( ... CACHE)
calls.
To create a "select one of three values" type of variable, you could do this:
set(MY_SELECTION "Option A" CACHE STRING "Help message for this variable")
set_property(
CACHE MY_SELECTION
PROPERTY STRINGS
"Option A" "Option B" "Option C"
)
This will create a variable named MY_SELECTION
visible in CMake UI, whose values can be chosen from between Option A
, Option B
, and Option C
. Its initial value will be Option A
and its help string will be Help message for this variable
.
Note that set(... CACHE ...)
calls only affect the variable's value if that variable does not yet exist. If the user already entered their own value, it will not be overridden (which is typically what you want in such case).