Using package managers with CMake
The easiest way to get dependencies into your project is to regularly install them using apt-get
, brew, or Chocolatey. The downside of installing everything is that you can pollute your system with many different versions of libraries and the version you are looking for might not be available at all. This is especially true if you are working on multiple projects with different requirements regarding the dependencies side by side. Often, a developer downloads the dependencies locally for each project so that each project can work independently. A very good way to handle dependencies is by using package managers such as Conan or vcpkg.
Using a dedicated package manager has many advantages when it comes to dependency management. Two of the more popular ones for handling C++ dependencies are Conan and vcpkg. Both can handle complex build systems and mastering them would require whole books on their own, so we will only cover the bare necessities to...