Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/showcase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
cmake .. -DCMAKE_BUILD_TYPE=Debug \
-DWITH_COVERAGE=YES \
-DWITH_FORTIFY_SOURCE=YES \
-DWITH_FORTIFY_SOURCE_LEVEL=3 \
-DWITH_ASAN=YES
make

Expand Down
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ set(CMAKE_C_STANDARD 99)

option(WITH_COVERAGE "Enable code coverage" OFF)
option(ALWAYS_VERBOSE "stcunit output is permanently verbose" OFF)
option(WITH_FORTIFY_SOURCE "Enable FORTIFY_SOURCE_LEVEL" 0)
option(WITH_ASAN "Enable Address Sanitizer")
option(WITH_FORTIFY_SOURCE "Enable _FORTIFY_SOURCE" OFF)
set(CACHE{WITH_FORTIFY_SOURCE_LEVEL}
TYPE STRING
HELP "Enable _FORTIFY_SOURCE level"
CACHE
VALUE 3
)

if (WITH_FORTIFY_SOURCE GREATER 0)
#
endif()
option(WITH_ASAN "Enable Address Sanitizer")

add_compile_options(-Wall -Wextra -pedantic -fvisibility=hidden)

Expand All @@ -30,10 +33,10 @@ endif()
add_executable(stcunit_showcase stcunit.h showcase.c)
if (WITH_FORTIFY_SOURCE)
target_compile_options(stcunit_showcase PRIVATE -g -O3 -fstack-protector-all)
target_compile_definitions(stcunit_showcase PRIVATE _FORTIFY_SOURCE=3)
target_compile_definitions(stcunit_showcase PRIVATE _FORTIFY_SOURCE=${WITH_FORTIFY_SOURCE_LEVEL})
endif()

if (WITH_ASAN)
target_compile_options(stcunit_showcase PRIVATE -fsanitize=address)
target_compile_options(stcunit_showcase PRIVATE -g -fno-omit-frame-pointer -fsanitize=address)
target_link_options(stcunit_showcase PRIVATE -fsanitize=address)
endif()
Loading