The code I use consists of set of modules, compiled to individual libraries. Libraries in turn, are linked in different combinations to build different binaries.
So for, it's pretty ordinal.
Different modules use diffe开发者_开发技巧rent command line arguments and I want to use Boost.Program_options for parsing.
Since the set of command line arguments depends on what libraries are link together, I don't know in advance all arguments and therefore can not add them to program_options::options_description.
How do you enable to each module to add it's command line arguments and later read them?
Thanks
E.g. by using options_description
s member function add(const options_description & desc)
to collect the options from your modules together in one description:
options_description & add(const options_description & desc) ;
Adds a group of option description. This has the same effect as adding alloption_descriptions
indesc
individually, except that output operator will show a separate group. Returns*this
.
Extracting options could be simply done by passing e.g. the variables_map
around to the modules.
精彩评论