Integrating Third-Party Libraries and Dependency Management
So far in this book, we have covered how to build and install our own code with CMake. In this chapter, we will look at how to use files, libraries, and programs that are not part of a CMake project. The first part of the chapter will be about how to find those things in general, while the latter part will focus on how to manage dependencies to build your CMake project.
One of the biggest advantages of using CMake is that it has built-in dependency management for the discovery of many third-party libraries. In this chapter, we will look at how to integrate libraries that are installed on your system and locally downloaded dependencies. Additionally, you will learn how third-party libraries can be downloaded and used as binaries and, alternatively, how they can be built from source directly out of a CMake project.
We will look at how to write instructions for CMake to reliably find almost any library on your system. Finally...