From 0ea3387b806ba37eb79307477c9f415735d02275 Mon Sep 17 00:00:00 2001
From: Eidolon <furyhunter600@gmail.com>
Date: Thu, 14 Jul 2022 18:33:40 -0500
Subject: [PATCH] cmake: Adjust linkage for macOS

This properly links dylibs set during build instead of expecting
the libraries to be in the system path.

# Conflicts:
#	src/sdl/CMakeLists.txt
---
 src/sdl/CMakeLists.txt | 45 ++++++++++++++++++------------------------
 1 file changed, 19 insertions(+), 26 deletions(-)

diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt
index 04670bdc8..4e4506932 100644
--- a/src/sdl/CMakeLists.txt
+++ b/src/sdl/CMakeLists.txt
@@ -147,37 +147,30 @@ if(${SDL2_FOUND})
 	set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
 
 	if(${CMAKE_SYSTEM} MATCHES Darwin)
-		find_library(CORE_LIB CoreFoundation)
+		find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation")
 		target_link_libraries(SRB2SDL2 PRIVATE
-			${CORE_LIB}
-			SDL2
-			SDL2_mixer
-			${GME_LIBRARIES}
-			${PNG_LIBRARIES}
-			${ZLIB_LIBRARIES}
-			${OPENGL_LIBRARIES}
-			${CURL_LIBRARIES}
-			${DISCORDRPC_LIBRARIES}
+			${CORE_FOUNDATION_LIBRARY}
 		)
 		set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
-	else()
+	endif()
+
+	target_link_libraries(SRB2SDL2 PRIVATE
+		${SDL2_LIBRARIES}
+		${SDL2_MIXER_LIBRARIES}
+		${GME_LIBRARIES}
+		${OPENMPT_LIBRARIES}
+		${MIXERX_LIBRARIES}
+		${PNG_LIBRARIES}
+		${ZLIB_LIBRARIES}
+		${OPENGL_LIBRARIES}
+		${CURL_LIBRARIES}
+	)
+
+	if(${CMAKE_SYSTEM} MATCHES Linux)
 		target_link_libraries(SRB2SDL2 PRIVATE
-			${SDL2_LIBRARIES}
-			${SDL2_MIXER_LIBRARIES}
-			${GME_LIBRARIES}
-			${PNG_LIBRARIES}
-			${ZLIB_LIBRARIES}
-			${OPENGL_LIBRARIES}
-			${CURL_LIBRARIES}
-			${DISCORDRPC_LIBRARIES}
+			m
+			rt
 		)
-
-		if(${CMAKE_SYSTEM} MATCHES Linux)
-			target_link_libraries(SRB2SDL2 PRIVATE
-				m
-				rt
-			)
-		endif()
 	endif()
 
 	#target_link_libraries(SRB2SDL2 PRIVATE SRB2Core)
-- 
GitLab