From 31c410656cb7c2d6b08f304c722c383fc5963766 Mon Sep 17 00:00:00 2001
From: GoldenTails <milestailsprower101n2@gmail.com>
Date: Tue, 20 Oct 2020 15:44:01 -0500
Subject: [PATCH] Add multithreading option for CMake

---
 src/CMakeLists.txt     | 2 ++
 src/sdl/CMakeLists.txt | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 962f8f87a..0da48fd80 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -231,6 +231,8 @@ set(SRB2_CONFIG_HAVE_OPENMPT ON CACHE BOOL
 	"Enable OpenMPT support.")
 set(SRB2_CONFIG_HAVE_CURL ON CACHE BOOL
 	"Enable curl support, used for downloading files via HTTP.")
+set(SRB2_CONFIG_HAVE_THREADS ON CACHE BOOL
+	"Enable multithreading support.")
 if(${CMAKE_SYSTEM} MATCHES Windows)
 	set(SRB2_CONFIG_HAVE_MIXERX ON CACHE BOOL
 		"Enable SDL Mixer X support.")
diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt
index 72f78188f..dab7f4934 100644
--- a/src/sdl/CMakeLists.txt
+++ b/src/sdl/CMakeLists.txt
@@ -55,6 +55,12 @@ set(SRB2_SDL2_HEADERS
 	sdlmain.h
 )
 
+if(${SRB2_CONFIG_HAVE_THREADS})
+	set(SRB2_HAVE_THREADS ON)
+	set(SRB2_SDL2_SOURCES ${SRB2_SDL2_SOURCES} i_threads.c)
+	add_definitions(-DHAVE_THREADS)
+endif()
+
 source_group("Interface Code" FILES ${SRB2_SDL2_SOURCES} ${SRB2_SDL2_HEADERS})
 
 # Dependency
-- 
GitLab