Getting the dependencies as source code
There are several ways to get dependencies as sources into your project. A relatively straightforward but dangerous way is to manually download or clone them into a subfolder inside your project and then add this folder with add_subdirectory
. While this works and is fast, it quickly becomes tedious and hard to maintain. So, this should be automated as soon as possible.
The practice of downloading and integrating a copy of third-party software directly into a product is called vendoring. While it has the advantage that it often makes building software easy, it creates issues with packaging libraries. Vendoring is avoided by either using a package manager or by installing third-party software into a location on your system.
Downloading dependencies as the source using pure CMake
At the base of getting external content is the CMake ExternalProject
module and the more sophisticated FetchContent
module, which is built on ExternalProject
...