From 5ed546b262cf1253df75841fe7e9dcd405c48b11 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 18 Jun 2023 10:42:18 +0200
Subject: [PATCH] cmake: don't treat deprecated declarations as an error
---
CMakeLists.txt | 1 +
cmake/PrivateSdlFunctions.cmake | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 37bf81e6..c4e82adf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -249,6 +249,7 @@ if(NOT ANDROID)
SOVERSION "${DYLIB_COMPAT_VERSION}"
VERSION "${DYLIB_CURRENT_VERSION}"
)
+ sdl_no_deprecated_errors(${sdl3_image_target_name})
else()
set_target_properties(${sdl3_image_target_name} PROPERTIES
SOVERSION "${SO_VERSION_MAJOR}"
diff --git a/cmake/PrivateSdlFunctions.cmake b/cmake/PrivateSdlFunctions.cmake
index 7c1dfc46..592e83c3 100644
--- a/cmake/PrivateSdlFunctions.cmake
+++ b/cmake/PrivateSdlFunctions.cmake
@@ -1,5 +1,7 @@
# This file is shared amongst SDL_image/SDL_mixer/SDL_ttf
+include(CheckCCompilerFlag)
+
macro(sdl_calculate_derived_version_variables MAJOR MINOR MICRO)
set(SO_VERSION_MAJOR "0")
set(SO_VERSION_MINOR "${MINOR_VERSION}")
@@ -253,3 +255,10 @@ function(sdl_add_warning_options TARGET)
endif()
endif()
endfunction()
+
+function(sdl_no_deprecated_errors TARGET)
+ check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
+ if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
+ target_compile_options(${TARGET} PRIVATE "-Wno-error=deprecated-declarations")
+endif()
+endfunction()