Maven-like dependency management for C++? [closed]
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?
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.
For the dependency management, it exists a new project (it is a startup company) which is implementing this type of tool: https://github.com/biicode (a C++ dependency manager). You could add your dependencies and it should work.
Currently, the project's name is conan.io, they were acquired by JFrog.
UPDATE: The project is dead... Unfortunately, it seems the startup couldn't get enough premium paying customers, but the server seems is working fine...
UPDATE2: It seems there is a substitute project: conan.io (thanks @mucaho)
I recommend the following high-level build systems:
- Maven Nar Plugin: Using Maven for C/C++ projects
- Gradle cpp plugin: It is an easier way, but it is currently incubating, here the main features and a roadmap.
- Conan is more C++ approach, it is multi-platform and it supports most common C++ build systems.