Best way to manage dependencies with c++?

This page summarizes the projects mentioned and recommended in the original post on /r/cpp

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • Vcpkg

    C++ Library Manager for Windows, Linux, and MacOS

    https://github.com/microsoft/vcpkg lets you automate the whole vcpkg setup/bootstrapping and package fetching/compiling as a CMake configuration-time task. And keep vcpkg and all packages local to your project. Using manifest mode you can as well check-in all your dependencies in version control (as mentioned by @Dragu) and get node/npm like dependency management with only one git submodule or copied .cmake file.

  • hunter

    CMake driven cross-platform package manager for C/C++. (by cpp-pm)

    I'd actually say it's essentially cmake hunter because there is no non-cmake step, rather than vcpkg where you need to install vcpkg first.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • cmake-init-conan-example

    cmake-init generated executable project with Conan integration

    Conan and vcpkg are the only options. I use them both, depends on what kinds of dependencies I want to pull. vcpkg is easier to setup custom one-off dependencies with using overlay ports, while Conan is faster at things if your profile fits one that has a pre-built binary in CCI. Both are trivial to integrate with a CMake project, see these examples for Conan and vcpkg.

  • cmake-init-vcpkg-example

    cmake-init generated executable project with vcpkg integration

    Conan and vcpkg are the only options. I use them both, depends on what kinds of dependencies I want to pull. vcpkg is easier to setup custom one-off dependencies with using overlay ports, while Conan is faster at things if your profile fits one that has a pre-built binary in CCI. Both are trivial to integrate with a CMake project, see these examples for Conan and vcpkg.

  • CPM.cmake

    📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

    In places where we haven't had the bandwidth to learn how to best use conan yet (deep embedded, webassembly, etc) we use CPM as a clean and easy to use wrapper around FetchContent. It is really great and I highly recommend it. You can even set an environmental variable for where it should clone/download things so you can re-use the source between projects. Binaries are always built from scratch.

  • cmake-conan

    CMake wrapper for conan C and C++ package manager

    I always wanted to try to use cmake-conan so I could let Conan grab all packages but have a neat cmake script being in charge of what gets built when. Also, this would allow me to easily switch between CMake fetchcontent and Conan packages that may or may not be stashed automatically on a local Artifactory server. Secondly, since now all build requirements are stashed on a server and binary reproducible, you could concider adding icecream and ccache into the mix. (Try running a node one of your buildservers for massive speadups with icecream) This however does require a reproducible build environment (by configure script) which conan again is really good in.

  • ccache

    ccache – a fast compiler cache

    I always wanted to try to use cmake-conan so I could let Conan grab all packages but have a neat cmake script being in charge of what gets built when. Also, this would allow me to easily switch between CMake fetchcontent and Conan packages that may or may not be stashed automatically on a local Artifactory server. Secondly, since now all build requirements are stashed on a server and binary reproducible, you could concider adding icecream and ccache into the mix. (Try running a node one of your buildservers for massive speadups with icecream) This however does require a reproducible build environment (by configure script) which conan again is really good in.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • icecream

    Distributed compiler with a central scheduler to share build load (by icecc)

    I always wanted to try to use cmake-conan so I could let Conan grab all packages but have a neat cmake script being in charge of what gets built when. Also, this would allow me to easily switch between CMake fetchcontent and Conan packages that may or may not be stashed automatically on a local Artifactory server. Secondly, since now all build requirements are stashed on a server and binary reproducible, you could concider adding icecream and ccache into the mix. (Try running a node one of your buildservers for massive speadups with icecream) This however does require a reproducible build environment (by configure script) which conan again is really good in.

  • conan-center-index

    Recipes for the ConanCenter repository

    Can you please point to the number of packages in hunter? From what I see in hunter there are 576 packages there, while ConanCenter contains now almost 1200

  • xmake

    🔥 A cross-platform build utility based on Lua

    And xmake also supports both vcpkg and conan out of the box. It includes xrepo package manager. More developers should know about xmake, IMHO.

  • vcpkg-tool

    Components of microsoft/vcpkg's binary.

    There's vcpkg the "tool" and vcpkg the "latest portfiles". Once upon a time those were developed in the same repository https://github.com/microsoft/vcpkg because we distributed the tool in source form. When we added binary releases people complained about the checkout time for the tool sources so we sucked that out into a separate repo https://github.com/microsoft/vcpkg-tool.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts