Config file to struct in C
This may fit perfectly depending on the purposes, or you could use another approach to be more efficient, clean or consistent.

If you just need to set a few variables of a project, and you don't mind running opts.c every time you change opts.cnf
Well, your existing solution fits perfectly.

If you are using ops.cnf to set some variables or constants at compilation time.
In this case, you may have to use #include and #define

If you are planning to use configuration file(s) for different sort of things in your project.
In this case I would recommend libconfig. Maybe LUA  or even Javascript.


Depending on your needs.