sdl2-compat: cmake: don't add X11_INCLUDE_DIRS if X11 is not found

From 7fe7730d67f8f90d6b4564b0ecd40d9518c96ac4 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Wed, 30 Nov 2022 00:14:47 +0100
Subject: [PATCH] cmake: don't add X11_INCLUDE_DIRS if X11 is not found

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dba5978..9016774 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,7 +127,9 @@ if(APPLE)
 #  set(DYLIB_COMPAT_VERSION 12.0.0 CACHE STRING "library compatibility version")
 #  set(DYLIB_CURRENT_VERSION 12.61.0 CACHE STRING "library current version")
   find_package(X11)
-  include_directories("${X11_INCLUDE_DIR}")
+  if(X11_FOUND)
+    include_directories("${X11_INCLUDE_DIR}")
+  endif()
   if(POLICY CMP0068)
     cmake_policy(SET CMP0068 NEW)  # on macOS, don't let RPATH affect install_name.
   endif()