How to distribute C++ libraries that depend on other libraries

What is the best way to do this ?

  1. Add the dependent libraries as git submodules to your source code and build them with your sources?
  2. Same as #1 but instead of git submodules offload the cloning and building to the build system much like described here.
  3. Don’t build dependencies, just list them and let the library user handle installation of it (statically or dynamically however he feels like).
  4. Build everything into a giant static library and hide it from the downstream user entirely.
  5. 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?
  6. Something much better that I am not thinking about here

I have a reasonable sense that #4 is out of the question.

  • Versioning with Visual Studio 2010 and HG
  • Is putting all project dependencies inside project's repository good practice?
  • Git cant diff or merge .cs file in utf-16 encoding
  • Which files in a Visual C# Studio project don't need to be versioned?
  • What's the Git way to work with C++ projects that share the same code at different revisions?
  • How to use libgit2sharp to create a new branch from local to remote?
  • 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.

  • How to use a different branch name when pushing to remote repo
  • Move Git home directory Windows 7
  • How can I create a gitsubtree of an existing repository?
  • git urlencode some characters
  • Show both tags and branches in Bitbucket under commits view
  • Rename folder in Git. All branches and all revisions
  • Git Baby is a git and github fan, let's start git clone.