I am using Gsettings schema and have com.test.gschema.xml file. Now some keys inside the schema are enum and thus I require com.test.enums.xml file.
Now I am using CMakeLists and thus can't use gsettings_ENUM_NAMESPACE and gsettings_ENUM_FILES. On searching I found out that we can make use of glib-mkenums utility but I tried generating the *.enums.xml file using it by providing it the .c and .h files having the enums declaration and definition but all it does is generate an empty file with no enums.
The
glib-mkenumsutility parses C files for enumeration definitions, and can be used to generate other files—typically, C sources for GType enumeration definitions to be used with GObject. The same utility can also be used for generating other file types, like the XML for GSettings schemas.You can look in the
gsettings.m4macro file shipped by GLib to get theglib-mkenumsincantation that the macros generate for you when using Autotools:Where
$NAMESPACEis the namespace of your library—and would be thegsettings_ENUM_NAMESPACEvalue;$INPUT_FILEScontains the list of files that define enumeration types to be used as settings values; and$OUTPUT_FILEis the XML file you're generating.I recommend reading the
glib-mkenumsmanual page, which lists all the expansions and options.