Package Managers (vcpkg & Conan) in C++
C++ long lacked a standard package manager, and two tools filled the gap: vcpkg (Microsoft, source-or-binary builds integrated with CMake) and Conan (decentralized, binary Caching, any build system). Both resolve named dependencies to exact versions, fetch and build them, and expose them to your build β vcpkg via toolchain file, Conan via generated CMake integration.
The workflow converges: declare dependencies (vcpkg.json manifest or conanfile.txt), install into the project, find_package in CMakeLists, link. Manifest mode pins versions per project, ending dependency drift between machines and CI.
Declare in a manifest
vcpkg.json lists {"dependencies": ["fmt", "zlib"]}; conanfile.txt lists [requires] fmt/10.0 β versions pinned per project.
Install into the project
The manager fetches sources, builds for your triplet/profile, and caches binaries for reuse across projects.
Consume from CMake
find_package(fmt CONFIG REQUIRED) plus target_link_libraries(app PRIVATE fmt::fmt) β the standard two lines per dependency.
vcpkg vs Conan
vcpkg: CMake-native, simplest for CMake shops. Conan: build-system-agnostic with stronger binary story. Either beats vendoring.
// vcpkg.json// { "dependencies": [ "fmt" ] }// CMakeLists.txt:// find_package(fmt CONFIG REQUIRED)// target_link_libraries(app PRIVATE fmt::fmt)#include <iostream>#include <fmt/core.h>int main() { std::cout << fmt::format("v{}", 10) << std::endl; return 0;}Recommended resourcesAffiliate links Β· may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in C++ yourself β building beats watching.