[cmake-developers] [CMake 0013091]: add enum like options

Mantis Bug Tracker mantis at public.kitware.com
Sat Mar 31 19:10:41 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13091 
====================================================================== 
Reported By:                Christoph Anton Mitterer
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13091
Category:                   CCMake
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-03-31 19:10 EDT
Last Modified:              2012-03-31 19:10 EDT
====================================================================== 
Summary:                    add enum like options
Description: 
Hi.

I know this is a duplicate of bugs
http://public.kitware.com/Bug/view.php?id=7313 and
http://public.kitware.com/Bug/view.php?id=1527 and the (not longer existing?)
http://public.kitware.com/Bug/view.php?id=39.
I also know there is no real way of implementing enums, given the way cmake
works.

But can't the following be done:

If for any variable "foo" a variable like "foo_ALLOWED_VALUES" exist, then and
UIs (like ccmake, etc.) are allowed to interpret this variable in order to
restrict the possible user inputs (yes I know it will still be possible via
manual editing and via the command line to set any value).

For the syntax of "foo_ALLOWED_VALUES" I'd recommend a extensible format e.g.:
"<type>:<type-dependent-data>"

Perhaps starting with the two types:
enum
regexp

1) enum could be something like this:
enum:value[|value]*
Where value is a allowed value.

2) regexp: could be something like this:
regexp:<regexp-type>:<expression>
With regexp-type being for example POSIX_BRE for POSIX Basic Regular
Expressions, or POSIX_ERE for POSIX Extended Regular Expressions.
Maybe later one could add PCRE.
expression would be the regular expression that must be matched for a value to
be allowed.


Why (1)?
(2) would not allow for UIs to make choices (e.g. drop down lists), at least not
easily.


Chris.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-03-31 19:10 Christoph Anton MittererNew Issue                              
     
======================================================================




More information about the cmake-developers mailing list