Using third-party libraries in your CMake project
If you’re writing software in earnest, sooner or later, you will hit the point where your project will rely on libraries from outside your project. Instead of looking for individual library files or header files, the recommended way to integrate third-party code into CMake-projects is to use the find_package
command to use CMake packages. Packages provide a set of information about dependencies for CMake and the generated build systems. They can be integrated into a project in two forms, either by their configuration details (also called config packages), or as so-called find
module packages. Config packages are usually provided by the upstream project, while packages using find
modules are usually defined either by CMake itself or by the project using the package. Both types can be found by using find_package
, and the result is a set of imported targets and/or a set of variables containing information that is relevant to the...