diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a0ecccf7..fd48c8ab1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,11 +203,13 @@ else() find_package(SDL2 REQUIRED) if(TARGET SDL2::SDL2) set(SDL2_TARGET SDL2::SDL2) - else() + elseif(TARGET SDL2::SDL2-static) # On some distros, such as vitasdk, only the SDL2::SDL2-static target is available. set(SDL2_TARGET SDL2::SDL2-static) # Alias to SDL2::SDL2 because some finder scripts may refer to SDL2::SDL2. add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) + else() + message(FATAL_ERROR "SDL2 cmake config found but it does not define SDL2::SDL2 nor SDL2::SDL2-static") endif() find_package(SDL2_ttf REQUIRED) find_package(SDL2_mixer REQUIRED)