From 30c53c95096a6b313f988737874aec98975dad24 Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:24:23 -0800 Subject: [PATCH] build: Disable _FORTIFY_SOURCE on Debug builds. (#7348) --- src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 37030b88a..e94302d31 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -110,12 +110,16 @@ else() # In case a flag isn't supported on e.g. a certain architecture, don't error. -Wno-unused-command-line-argument # Build fortification options - -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection ) + if (NOT CMAKE_BUILD_TYPE STREQUAL Debug) + # _FORTIFY_SOURCE can't be used without optimizations. + add_compile_options(-Wp,-D_FORTIFY_SOURCE=2) + endif() + if (CITRA_WARNINGS_AS_ERRORS) add_compile_options(-Werror) endif()