Using dependencies not present in the system
CMake excels at managing dependencies, particularly when they're not already installed on the system. There are several approaches you can take. If you're using CMake version 3.14 or newer, the FetchContent module is your best choice for managing dependencies. Essentially, FetchContent is a user-friendly wrapper around another module called ExternalProject. It not only simplifies the process but also adds some extra features. We'll dive deeper into ExternalProject later in this chapter. For now, just know that the main difference between the two is the order of execution:
FetchContentbrings dependencies in during the configuration stage.ExternalProjectbrings dependencies in during the build stage.
This order is significant, as targets defined by FetchContent during the configuration stage will be in the same namespace, and as such can be easily used by our project. We can link them with other targets, just as if we had defined...