How to build dune projects with optional dependencies (like C libraries)

It took me a while to understand how to setup a build system using dune that could have optional packages, e.g. a speex package inside ocaml-xiph that would only build their libraries and executable when pkg-config detects the library.

It took a while and a couple of bug fixes to achieve but we finally closed the loop on that so I wanted to share in case that could be useful to anyone: How to Build Optional Modules with Dune

6 Likes