cmaize.user_api/cmaize_option
- cmaize.user_api/cmaize_option.cmaize_option(_co_name _co_default_value _co_docstring)
Registers a configuration option with the current project.
Note
Unlike CMake’s
optioncommand values are not restricted to booleans.Build system mainainers can declare configuration options for their build system via the
cmaize_optionfunction. Consistent with usual build sytem behavior, users can override the default value. Assuming a call tocmaize_optionlikecmaize_option(option_name option_value option_description), users of the build system can set the value of theoption_nameoption by:setting a
option_namevariable before callingcmaize_option,setting a
option_namecache variable before callingcmaize_option, or bysetting the configuration option
option_nameon the project’s CMaizeProject object directly (not recommended for end users).
If the user has not set the value via any of the above mechanisms
cmaize_optionwill set the value ofoption_nametooption_value.After calling this function the CMake variable
option_nameis guaranteed to be set. Similar to CMake’soptioncommand, the CMake cache variableoption_namewill be set if a normal (or cache) CMake variableoption_namewas not already set.- Parameters:
name (desc) – The name of the configuration option being set.
default_value (str) – The value to set
nameto if the user does not provide a value.docstring (str) – A brief description of what the option does. This parameter’s value is used primarily as metadata.
- cmaize.user_api/cmaize_option.cmaize_option_list()
Convenience function for registering a number of options with CMaize.
Many projects have multiple configuration options. Rather than having to call
cmaize_optionfor each option,cmaize_option_listallows you to provide a list of key/value pairs. Under the hood this function simply loops over the key/value pairs and forwards them tocmaize_option, thus all documentation relating tocmaize_optionapplies here as well.- Parameters:
*args –
A variadiac list of key/value pairs. The
2i-th argument will be interpretted as the key for thei-th pair and the2i + 1-th argument will be interpretted as the value for thei-th pair.- Raises:
input_error – If the number of arguments is not divisible by 2.