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

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

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6edba99fb69a..c9cd8b35592e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2973,6 +2973,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 required on Apple platforms")
+  endif()
   sdl_compile_options(PRIVATE "-fobjc-arc")
 endif()