SDL: cmake: on Apple, check for presence of an OBJC compiler

From 61297f703a20c50f046a03ff9130215cce9581dd Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 29 Oct 2022 03:20:30 +0200
Subject: [PATCH] cmake: on Apple, check for presence of an OBJC compiler

---
 CMakeLists.txt     | 1 +
 cmake/macros.cmake | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ecc74cad100f..bbb200274db6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,6 +58,7 @@ endif()
 include(CheckLibraryExists)
 include(CheckIncludeFiles)
 include(CheckIncludeFile)
+include(CheckLanguage)
 include(CheckSymbolExists)
 include(CheckCSourceCompiles)
 include(CheckCSourceRuns)
diff --git a/cmake/macros.cmake b/cmake/macros.cmake
index 5830fceed957..6f6c329714a3 100644
--- a/cmake/macros.cmake
+++ b/cmake/macros.cmake
@@ -110,6 +110,13 @@ else()
   endif()
 endif()
 
+if(APPLE)
+  check_language(OBJC)
+  if(NOT CMAKE_OBJC_COMPILER)
+    message(WARNING "Cannot find working OBJC compiler.")
+  endif()
+endif()
+
 if(CMAKE_VERSION VERSION_LESS 3.13.0)
   macro(target_link_directories _TARGET _SCOPE)
     link_directories(${ARGN})