build: only increase stack size in non-debug builds

Signed-off-by: Lenny McLennington <lenny@sneed.church>
This commit is contained in:
Lenny McLennington 2022-11-24 18:20:18 +00:00
parent 22fb301d88
commit 90bbde3631
No known key found for this signature in database
GPG Key ID: F0467078ECA45FCB

View File

@ -34,7 +34,10 @@ set(CMAKE_C_STANDARD 11)
include(GenerateExportHeader)
set(CMAKE_CXX_FLAGS "-Wall -pedantic -fstack-protector-strong --param=ssp-buffer-size=4 ${CMAKE_CXX_FLAGS}")
if(WIN32)
# Increases the stack size to 8MB for Windows, only when not building in Debug mode
# because we don't want random users being affected by stack overflows in release builds,
# but it's fine in debug builds for finding and fixing them
if((NOT CMAKE_BUILD_TYPE STREQUAL "Debug") AND WIN32)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--stack,8388608 ${CMAKE_EXE_LINKER_FLAGS}")
endif()