From 0cb7dc5c3a4a7ffd24823198a5c26adffe04bc56 Mon Sep 17 00:00:00 2001
From: Charlie Birks <[EMAIL REDACTED]>
Date: Tue, 14 Dec 2021 10:31:22 +0000
Subject: [PATCH] cmake: (Re-)fix building with SDL < 2.0.12
Which is what the action build uses.
---
CMakeLists.txt | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea894966..d699e35b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,15 @@ option(BUILD_SHARED_LIBS "Enable shared library" ON)
if (NOT ANDROID AND NOT (TARGET SDL2 OR TARGET SDL2-static))
find_package(SDL2 REQUIRED)
+
+ if(NOT TARGET SDL2::SDL2)
+ # SDL < 2.0.12
+ add_library(SDL2::SDL2 INTERFACE IMPORTED)
+ set_target_properties(SDL2::SDL2 PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR}
+ INTERFACE_LINK_LIBRARIES ${SDL2_LIBRARIES} ${SDL2_LIBRARY}
+ )
+ endif()
endif()
include_directories(include src src/codecs)