diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 37030b88ab..e94302d311 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()