How is SDL2 supposed to be used with CMake?

My Pull Request that hopefully fixes some of these issues is now ready: Improve sdl2-config.cmake.in and SDL2Config.cmake by DanielGibson · Pull Request #4320 · libsdl-org/SDL · GitHub - it would be cool of someone could test it, especially if you’re not using Windows or Linux (those are the platforms I could test myself).

There is a small test application at SDL2 + CMake test · GitHub
Build and install SDL2 yourself (with the branch of the pull request that you can also download as a .zip) - either with CMake or with autotools (./configure && make -j4 && make install) or ideally try both :slight_smile:
Then try to build my test application with that freshly installed SDL2:
In the directory with my CMakeLists.txt and main.cpp, do

mkdir build
cd build
cmake -DSDL2_DIR=/path/to/sdl2-installation/lib/cmake/SDL2/ ..
make

This should create two executables, SDL2Test and SDL2Test2 that should both show a grey window when started - it can be closed with [Q] or Esc.

Thanks in advance!