Skip to content

Commit

Permalink
Define NDEBUG in CMakeLists.txt and Makefile
Browse files Browse the repository at this point in the history
This will disable the pre-condition assertions in all functions,
which should never be false for releases anyway.
  • Loading branch information
Matthäus Wininger committed Dec 21, 2023
1 parent 1755b7c commit dfc4a70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ project(zps C)
# Target
set(TARGET "zps")
# Add project source
add_executable(${TARGET} src/${TARGET}.c src/${TARGET}.h)
add_executable(${TARGET})
target_sources(${TARGET} PRIVATE src/${TARGET}.c src/${TARGET}.h)
# Compile options
target_compile_options(${TARGET} PRIVATE -s -O3 -Wall -Wextra -pedantic)
target_compile_definitions(${TARGET} PRIVATE NDEBUG)
# Install
install(TARGETS ${TARGET} RUNTIME DESTINATION bin)
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Project and compiler information
NAME := zps
CFLAGS := -s -O3 -Wall -Wextra -pedantic
CFLAGS := -s -O3 -Wall -Wextra -pedantic -DNDEBUG
ifeq ($(CC),)
CC := gcc
endif
Expand Down

0 comments on commit dfc4a70

Please sign in to comment.