Maven-like dependency management for C++?

weberste picture weberste · Jul 16, 2009 · Viewed 57.8k times · Source

Say I have a C++ project that is split in several subprojects. The subproject all produce a DLL and different teams of developers work on each of the subproject. Now if I want to build the main project, is there a way to avoid having to build all the subprojects by myself?

In short, I'm looking for something that does the dependency management (i.e. for binary files and headers) in a similar way as Maven does for Java.

In fact, I tried to use Maven for this but this is rather cumbersome because I have to create the packages manually and quite frequently, Maven misses to pick up the most recent changes. Also, running the compilation is a bit of a hack as I have to call NAnt from within Maven (I use NAnt's feature to build Visual Studio solutions directly).

Any hints and ideas of how to do this?

Answer

ovanes picture ovanes · Jul 16, 2009

Initial Answer: I would suggest using CMake. It is a multi-platform make file generator (generates Visual Studio or Eclipse CDT projects as well).

http://www.cmake.org/

I did really good experience with it. The best thing I like about it was the ability to produce generic project structure. So you can generically include sub-projects look-up for unit tests etc. without changing the script every time.

They have also lots of modules on how to find pre-installed build libraries, required for the project (like Boost, QT etc.)


Update: In the mean time there was some effort to introduce package management for C++. Some projects worth looking at:

  • conan.io integrates with major build tools:
    • CMake
    • Visual Studio
    • Makefile
    • XCode
    • ...
  • cpm based on CMake (Note CPM is not being actively maintained.)
  • Buckaroo

Note as pointed out by @RAM in the comments cpm is no longer actively maintained.