How to distribute C++ libraries that depend on other libraries
What is the best way to do this ?
- Add the dependent libraries as git submodules to your source code and build them with your sources?
- Same as #1 but instead of git submodules offload the cloning and building to the build system much like described here.
- Don’t build dependencies, just list them and let the library user handle installation of it (statically or dynamically however he feels like).
- Build everything into a giant static library and hide it from the downstream user entirely.
- Use one of the dependency managers made famous by other languages like maven, ant, gradle, gem, pip. Do any of these work well with C++ libraries?
- Something much better that I am not thinking about here
I have a reasonable sense that #4 is out of the question.
I have been trying to use #1 but I am already bumping into the inconveniences of git submodules.
I feel like #2 is similar but slightly better than #1 but if you do that, how do you do your development? Do you install the dependent libraries in your system or keep them in the source tree (but not in the source control) to mimic the build environment?
Many questions, but hoping for one ultimate answer.