SDL: cmake: check -fobjc-arc compiler flag on Apple platforms (0f885)

From 0f8858cf2d05548e18142fc952fddb1d27dacfc3 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 30 Oct 2023 19:56:46 +0100
Subject: [PATCH] cmake: check -fobjc-arc compiler flag on Apple platforms

(cherry picked from commit 20630b2e6c02e40b5da12cccb7e74ef2b8fdfc08)
---
 CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14ad9e0b6c21..7ec5ced3a5c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3337,6 +3337,10 @@ if(ANDROID)
 endif()
 
 if(APPLE)
+  check_c_compiler_flag(-fobjc-arc COMPILER_SUPPORTS_-fobjc-arc)
+  if(NOT COMPILER_SUPPORTS_-fobjc-arc)
+    message(FATAL_ERROR "Compiler does not support -fobjc-arc: this is requires on Apple platforms")
+  endif()
   target_compile_options(sdl-build-options INTERFACE "-fobjc-arc")
 endif()