Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Every way to bring in a library

FetchContent, vcpkg, Conan, an installed package, or a C library you wrap yourself. How each gets the code into your build.

Whichever tool fetches it, your CMakeLists.txt ends the same way: target_link_libraries(<your target> PRIVATE <library's :: target>). Pick the tool by the library and the project.

  • Small, quick to build, one or two of them → FetchContent: CMake downloads and builds it with your project.
  • Big, or many, and building each once on your machine is fine → vcpkg in manifest mode.
  • Many, on many platforms, and you'd like prebuilt binaries where they exist → Conan 2.
  • Already installed, by a package manager or by its own cmake --install → find_package.
  • A plain C library with no CMake support → wrap it in a small C++ class so the rest of your code gets RAII and C++ errors.

Before choosing any of them, check whether the library is header-only, static or shared. That decides what has to be found at run time.

What you're bringing in

The three tools

Section

FetchContent

Build it from source, inside your own build.

A vcpkg.json lists what you need; the toolchain file makes find_package see it.

Section

Conan 2

A conanfile and a profile, with prebuilt binaries where they match your settings.

Already installed, or your own

The other side of the same deal, making your own library findable.

A C library