views:

40

answers:

1

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 different 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

+2  A: 

E.g. by using options_descriptions 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 all option_descriptions in desc 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.

Georg Fritzsche