sdl2-compat: cmake: fail when SDL3_INCLUDE_DIRS is not set (by SDL3Config or find_path()

From 3bde1f60d34760872e60de30f987fb33c1cb9e62 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 27 Nov 2022 19:33:14 +0100
Subject: [PATCH] cmake: fail when SDL3_INCLUDE_DIRS is not set (by SDL3Config
 or find_path()

---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26da7ce..560044b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,12 +26,15 @@ include(GNUInstallDirs)
 
 set(CMAKE_SKIP_RPATH TRUE)
 
-find_package(SDL3)
+find_package(SDL3 QUIET)
 if(NOT SDL3_INCLUDE_DIRS)
   find_path(SDL3_INCLUDE_DIRS
     NAMES "SDL3/SDL.h"
   )
 endif()
+if(NOT SDL3_INCLUDE_DIRS)
+  message(FATAL_ERROR "Cannot find SDL3 headers: configure with -DCMAKE_PREFIX_PATH=\"/root/to/SDL3\" or -DSDL3_INCLUDE_DIRS=\"/root/to/SDL3/include\"")
+endif()
 
 find_package(Git)
 if(Git_FOUND)