From 235afdff726d3bae56c2d907b530debea276f47d Mon Sep 17 00:00:00 2001
From: Logan Aerl Arias <logana@srb2.org>
Date: Sat, 24 Feb 2024 19:37:38 -0500
Subject: [PATCH] disable libgme by default

---
 CMakeLists.txt            |  1 +
 src/CMakeLists.txt        | 12 +++++++-----
 thirdparty/CMakeLists.txt |  4 +++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8803620e7..358e62cc4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,6 +70,7 @@ cmake_dependent_option(
 	OFF
 )
 option(SRB2_CONFIG_HWRENDER "Enable hardware render (OpenGL) support" ON)
+option(SRB2_CONFIG_USE_GME "Enable GME playback support" OFF)
 option(SRB2_CONFIG_STATIC_OPENGL "Enable static linking GL (do not do this)" OFF)
 option(SRB2_CONFIG_ERRORMODE "Compile C code with warnings treated as errors." OFF)
 option(SRB2_CONFIG_DEBUGMODE "Compile with PARANOIA, ZDEBUG, RANGECHECK and PACKETDROP defined." OFF)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 160174080..1bdfc94f5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -173,11 +173,13 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
 	target_compile_definitions(SRB2SDL2 PRIVATE -DMACOSX)
 endif()
 
-target_link_libraries(SRB2SDL2 PRIVATE gme)
-target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
-if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
-	# this sucks but gme doesn't use modern cmake to delineate public headers
-	target_include_directories(SRB2SDL2 PRIVATE "${libgme_SOURCE_DIR}")
+if("${SRB2_CONFIG_USE_GME}")
+	target_link_libraries(SRB2SDL2 PRIVATE gme)
+	target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
+	if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
+		# this sucks but gme doesn't use modern cmake to delineate public headers
+		target_include_directories(SRB2SDL2 PRIVATE "${libgme_SOURCE_DIR}")
+	endif()
 endif()
 
 target_link_libraries(SRB2SDL2 PRIVATE openmpt)
diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt
index f33b3bf3f..19aa22c9b 100644
--- a/thirdparty/CMakeLists.txt
+++ b/thirdparty/CMakeLists.txt
@@ -18,4 +18,6 @@ if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
 	include("cpm-openmpt.cmake")
 endif()
 
-include("cpm-libgme.cmake")
+if("${SRB2_CONFIG_USE_GME}")
+	include("cpm-libgme.cmake")
+endif()
-- 
GitLab