[CMake] CMake based package manager

Ruslan Baratov ruslan_baratov at yahoo.com
Mon Jun 23 11:38:43 EDT 2014


Hi,

I'm developing a project that is a kind of wrapper of 
ExternalProject_Add and
allow it to be more reusable. User interface is quite simple.

For example adding Boost:

     hunter_add_package(Boost COMPONENTS system filesystem)
     find_package(Boost REQUIRED system filesystem)

... or GTest (it's patched version):

     hunter_add_package(GTest)
     find_package(GTest CONFIG REQUIRED)
     target_link_libraries(... PUBLIC GTest::main)

The idea is to focus all builds in one place and let the outside projects
make requests to add/install new libraries there. At the same time overhead
is quite small. Every project hold one file (~ 10 KB) (that called gate) 
which
will download archive (~ 30 KB) with other packages' sha1 and download URLs.
External project from this set will be build and installed only if 
somebody call
`hunter_add_package` command.

I've made a test-drive project, so you can check how it works:

* https://github.com/forexample/hunter-simple

And the bigger one with Boost, CppNetlib.URI, GTest, JSON Spirit:

* https://github.com/ruslo/weather

I've tested it on Windows (Visual Studio), Linux, Mac OS X (+ iOS).

(Notes for windows: project should works fine on cygwin and mingw platforms,
but cygwin has old g++ version with lack of c++11 support and boost 
failed to
build with mingw)

For anybody interested, here is a github project:

* https://github.com/ruslo/hunter


More information about the CMake mailing list