SDL_mixer: cmake: fix macho {compatibility,current} version

From 6aa0aec1ebb6374d4eeab6d9cf7d5edf608e400e Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Wed, 1 May 2024 22:17:59 +0200
Subject: [PATCH] cmake: fix macho {compatibility,current} version

---
 .github/workflows/main.yml |  5 -----
 CMakeLists.txt             | 18 +++++++-----------
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index d501ac41..b58c03e2 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -107,11 +107,6 @@ jobs:
         .github/fetch_yasm.ps1
         echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
 
-    - name: Setup (CMake)
-      if: ${{ !matrix.platform.msystem && !matrix.platform.msvc }}
-      uses: jwlawson/actions-setup-cmake@v1.14
-      with:
-        cmake-version: '3.16'
     - name: Configure (CMake)
       run: |
         set -- \
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 756f3e45..5b13c1f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,8 +98,6 @@ if(SDL3MIXER_STRICT)
   set(required "REQUIRED")
   set(fatal_error "FATAL_ERROR")
 endif()
-set(SDL3MIXER_DEPS_FOUND )
-set(SDL3MIXER_DEPS_NOT_FOUND )
 
 option(SDL3MIXER_SAMPLES "Build the SDL3_mixer sample program(s)" ${SDL3MIXER_SAMPLES_DEFAULT})
 cmake_dependent_option(SDL3MIXER_SAMPLES_INSTALL "Install the SDL3_mixer sample program(s)" OFF "SDL3MIXER_SAMPLES;SDL3MIXER_INSTALL" OFF)
@@ -296,17 +294,15 @@ set_target_properties(${sdl3_mixer_target_name} PROPERTIES
     C_VISIBILITY_PRESET "hidden"
 )
 if(NOT ANDROID)
+    set_target_properties(${sdl3_mixer_target_name} PROPERTIES
+        SOVERSION "${SO_VERSION_MAJOR}"
+        VERSION "${SO_VERSION}"
+    )
     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
-        set_target_properties(${sdl3_mixer_target_name} PROPERTIES
-            SOVERSION "${DYLIB_COMPAT_VERSION}"
-            VERSION "${DYLIB_CURRENT_VERSION}"
-        )
-    else()
+        cmake_minimum_required(VERSION 3.17)
         set_target_properties(${sdl3_mixer_target_name} PROPERTIES
-            SOVERSION "${SO_VERSION_MAJOR}"
-            VERSION "${SO_VERSION}"
+            MACHO_COMPATIBILITY_VERSION "${DYLIB_COMPAT_VERSION}"
+            MACHO_CURRENT_VERSION "${DYLIB_CURRENT_VERSION}"
         )
     endif()
 endif()