From dc103330ac4b9f177307b7a25a178420803d1278 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 30 Dec 2022 20:17:26 -0800 Subject: [PATCH 1/3] Rename strcasestr to nongnu_strcasestr, macro strcasestr ifndef _GNU_SOURCE Fix for GCC C++ compiler, which always defines _GNU_SOURCE. --- src/doomtype.h | 5 ++++- src/strcasestr.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/doomtype.h b/src/doomtype.h index c59e17381..617fd4d47 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 2796f11d5..37899a842 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; From 34f2594b4826a200ca50ecbf62652d5ffa181617 Mon Sep 17 00:00:00 2001 From: SteelT Date: Wed, 26 Jul 2023 14:09:48 -0400 Subject: [PATCH 2/3] Update Catch2 to latest version This combined with the previous commit fixes building the test suite --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a21d22b34..7d36c1fb6 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" From 7261db1eee9ee02fceb52c54265c233b0fff3ca5 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 20 Feb 2023 02:15:50 -0800 Subject: [PATCH 3/3] cmake: fix -DSRB2_CONFIG_ENABLE_TESTS=OFF build --- src/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f3ed96f89..b62237374 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.