From eb4fbdc30246fac46c67736892ee3e19fffbcd90 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Mon, 26 Apr 2021 13:08:56 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20CMake:=20Better=20error=20messag?= =?UTF-8?q?e=20for=20bad=20SDL2=20configs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)