diff options
author | Jo-Philipp Wich <jo@mein.io> | 2023-11-01 13:57:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2023-11-01 13:57:05 +0100 |
commit | ea046bdae231988bda123995676e60db0aaa8745 (patch) | |
tree | ec7c2afb4367ee56746980ac981abc6e62b716da | |
parent | 07c03173d4e6a30953f92fa88ed29b0b956c9106 (diff) |
build: enable source fortification by default
Also switch debug builds to -Og instead of -O0 in order to make
-D_FORTIFY_SOURCE=2 effective for debug builds.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | CMakeLists.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ce907dd..e3cc37e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ include(CheckFunctionExists) include(CheckSymbolExists) project(ucode C) -add_definitions(-Os -Wall -Werror --std=gnu99 -ffunction-sections -fwrapv -D_GNU_SOURCE) +add_definitions(-Os -Wall -Werror --std=gnu99 -ffunction-sections -fwrapv -D_GNU_SOURCE -D_FORTIFY_SOURCE=2) if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6) add_definitions(-Wextra -Werror=implicit-function-declaration) @@ -68,7 +68,7 @@ else() endif() if(DEBUG) - add_definitions(-DDEBUG -g3 -O0) + add_definitions(-DDEBUG -g3 -Og) else() add_definitions(-DNDEBUG) endif() |