What is the good practice to expose a dependency's feature?


I am in the following situation: I have a crate (cvode_wrap) that depends on a -sys crate (sundials-sys). The -sys crate has an optional feature (build_libraries) to build the vendored C library instead of trying to link to the system one. I want to expose or at least advertise this feature to my users and I'm hesitating between the following choices:

  1. Add a feature build_libraries to cvode_wrap that merely activates the one in sundials-sys. But that just moves the problem one level in the dependency graph.
  2. Suggest to my users that they use sundials-sys/build_libraries as a feature of cvode_wrap, but I'm not sure how that would work if a crate C then depends on cvode_wrap.
  3. Suggest to my users (and their users in turn) that they specifically add sundials-sys = {version = "*", default-features=false, features=["build_libraries"]} to their Cargo.toml.

Do you have any advice, what are the pros and cons of each one?


I would usually just go for option 3.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.