I've been working on a C++ project using CMake as my build-system generator and I'm about to get a second developer on board.
I work on OSX with dependencies installed using Homebrew.
They are going to work on Windows (they are going to work on some of the cross-platform issues, so this choice is deliberate).
What I'm struggling with, is how to manage the dependencies in the project so that it's as easy as possible to onboard this new developer and any future ones (agnostic of platform).
The approaches I've considered are as follows:
- Make developers install all dependencies using brew/apt/downloading them and letting my FindX.cmake scripts sort it out (with special environment variables for Windows).
- Include pre-compiled dependencies in a folder within the project and link to those (for all supported platforms).
- Use git submodules to include the source of the dependencies in the project and use add_subfolder in CMake to compile them.
I think the second approach is the "right" one, as it's the least friction for new developers and means that the dependencies don't have to be compiled the first time.
The only concern I have about this is that at some point (before I'm ready to distribute the project) I want to switch to static linking (is this even a good idea?). This is fine for simple dependencies with no dependencies themselves.
However, what about the more complex ones like SDL? Do I then need to include static versions of all it's dependencies (OpenGL etc.), that doesn't seem great. I noticed SFML does this (in the /extlibs folder), but it doesn't include everything is depends on, only a few (for example OpenGL is not included), how do I know which ones I need to include and which I don't?