From 869b18c329c42db967f71f07a66473189f44cf11 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sat, 22 Feb 2025 11:29:42 +0100 Subject: [PATCH] Force C standard to gnu99 in cmake builds. The Makefiles forces gnu99 since ages. Additionally gcc15 started to default to C23 and our code doesn't (yet) build with it. Reported in issue #20. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 072c844..0f237ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,10 +13,11 @@ project(yquake2-ctf) # Enforce compiler flags (GCC / Clang compatible, yquake2 # won't build with another compiler anyways) +# -std=gnu99 -> Force same C standard as in the Makefile # -Wall -> More warnings # -fno-strict-aliasing -> Quake 2 is far away from strict aliasing # -fwrapv -> Make signed integer overflows defined -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-strict-aliasing -fwrapv") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -fno-strict-aliasing -fwrapv") # Use -O2 as maximum optimization level. -O3 has it's problems with yquake2. string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")