diff --git a/CMakeLists.txt b/CMakeLists.txt
index a21d22b34b72445acb648160a4839ca6b4cda12d..7d36c1fb63a46cffe860de94cc8994067c82bc51 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -84,7 +84,7 @@ if(SRB2_CONFIG_ENABLE_TESTS)
 	# https://github.com/catchorg/Catch2
 	CPMAddPackage(
 		NAME Catch2
-		VERSION 3.1.1
+		VERSION 3.4.0
 		GITHUB_REPOSITORY catchorg/Catch2
 		OPTIONS
 			"CATCH_INSTALL_DOCS OFF"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f3ed96f892f8866c81e023632cf123db1b76ff27..b62237374295ce93feeecb64a40220d4a6ce1561 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -293,7 +293,9 @@ if(SRB2_CONFIG_PROFILEMODE AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
 endif()
 
 add_subdirectory(sdl)
-add_subdirectory(tests)
+if(SRB2_CONFIG_ENABLE_TESTS)
+	add_subdirectory(tests)
+endif()
 
 # strip debug symbols into separate file when using gcc.
 # to be consistent with Makefile, don't generate for OS X.
diff --git a/src/doomtype.h b/src/doomtype.h
index c59e1738135ac577024355b415a43bfca981431f..617fd4d4772a11b5af88deb428df602744c561ea 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -100,7 +100,10 @@ typedef long ssize_t;
 	#define strnicmp(x,y,n) strncasecmp(x,y,n)
 #endif
 
-char *strcasestr(const char *in, const char *what);
+char *nongnu_strcasestr(const char *in, const char *what);
+#ifndef _GNU_SOURCE
+#define strcasestr nongnu_strcasestr
+#endif
 #define stristr strcasestr
 
 int startswith (const char *base, const char *tag);
diff --git a/src/strcasestr.c b/src/strcasestr.c
index 2796f11d52658f2376b547a3d41d6b2d2974f15e..37899a8425b3d2082957c41cbdae07056798fe74 100644
--- a/src/strcasestr.c
+++ b/src/strcasestr.c
@@ -61,7 +61,7 @@ swapp (char ***ppap, char ***ppbp, char **cpap, char **cpbp)
 }
 
 char *
-strcasestr (const char *s, const char *q)
+nongnu_strcasestr (const char *s, const char *q)
 {
 	size_t  qn;