SDL: [ios] Fix failing to link iconv when build using CMake

From d68b429cfb79e99abc5fdc206b4fe4fc8dac7731 Mon Sep 17 00:00:00 2001
From: Anders Jenbo <[EMAIL REDACTED]>
Date: Thu, 2 Dec 2021 23:57:00 +0100
Subject: [PATCH] [ios] Fix failing to link iconv when build using CMake

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 877735b692..6e8ecda134 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -914,12 +914,14 @@ if(SDL_LIBC)
     endif()
 
     check_library_exists(iconv iconv_open "" HAVE_LIBICONV)
-    check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)
-    if(HAVE_BUILTIN_ICONV)
-      set(HAVE_ICONV 1)
-    elseif(HAVE_LIBICONV)
+    if(HAVE_LIBICONV)
       list(APPEND EXTRA_LIBS iconv)
       set(HAVE_ICONV 1)
+    else()
+      check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)
+      if(HAVE_BUILTIN_ICONV)
+        set(HAVE_ICONV 1)
+      endif()
     endif()
 
     if(NOT APPLE)