SDL_image: cmake: use MACHO* properties to set macho version

From 564557ea8c7a7d281db373b6fc259de45536bd06 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Wed, 3 Apr 2024 17:03:37 +0200
Subject: [PATCH] cmake: use MACHO* properties to set macho version

---
 .github/workflows/main.yml | 5 -----
 CMakeLists.txt             | 8 ++++----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index bb964512..3d798b25 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -96,11 +96,6 @@ jobs:
       if: ${{ runner.os == 'Linux' }}
       run: ./build-scripts/test-versioning.sh
 
-    - name: Set up CMake 3.16
-      if: ${{ !matrix.platform.msystem && !matrix.platform.msvc }}
-      uses: jwlawson/actions-setup-cmake@v1.14
-      with:
-        cmake-version: '3.16'
     - name: Configure (CMake)
       run: |
         export CMAKE_CONFIGURATION_TYPES=Release
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ac336ff..fed77ffb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -308,11 +308,11 @@ sdl_target_link_option_version_file(${sdl3_image_target_name} "${CMAKE_CURRENT_S
 
 if(NOT ANDROID)
     if(APPLE)
-        # the SOVERSION property corresponds to the compatibility version and VERSION corresponds to the current version
-        # https://cmake.org/cmake/help/latest/prop_tgt/SOVERSION.html#mach-o-versions
+        cmake_minimum_required(VERSION 3.17)
         set_target_properties(${sdl3_image_target_name} PROPERTIES
-            SOVERSION "${DYLIB_COMPAT_VERSION}"
-            VERSION "${DYLIB_CURRENT_VERSION}"
+            SOVERSION "${SO_VERSION_MAJOR}"
+            MACHO_COMPATIBILITY_VERSION "${DYLIB_COMPATIBILITY_VERSION}"
+            MACHO_CURRENT_VERSION "${MACHO_CURRENT_VERSION}"
         )
         sdl_no_deprecated_errors(${sdl3_image_target_name})
     else()