Time to time I see people struggle setting up SDL2 with CMake on their machines. This template project shows one of the possible solutions to do so.
- Has SDL2 as git submodule
- Fetches && sets up SDL2 library for use in the project
- Clone repository to your desired location
- Run cmake
- IDEs and text editors with CMake support / extensions will pick everything up automatically
- For manual build: from repository's root directory run
cmake -S . -B build
command, where.
is your source directory andbuild
is build one.
- Wait for CMake to finish fetching SDL2, index files and build program
- When finished program can be run where simple SDL2 window will be present