-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Minimal CMake
By :

With our library installed, what remains is to integrate it into our existing application so we can start using the functionality provided by SDL. Let’s begin by looking at the changes made to our CMakeLists.txt
file for our application.
We won’t share the entire file here as much of it is the same as before, but we’ll call out the significant changes as we go. To see a complete example, review ch6/part-1/app/CMakeLists.txt
from the book’s accompanying repository.
The first, and perhaps most important addition, is as follows:
find_package(SDL2 CONFIG REQUIRED)
The find_package
command is an incredibly useful tool to bring external dependencies into our project. In the example shown above, the first argument is the name of the dependency to find (in our case, this is SDL2
). The name of the dependency is defined in one of two ways, and that is linked to the second parameter we’ve specified, CONFIG
.