diff options
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 29f567b..73d2a62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(aplwc LANGUAGES C ) -set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD 90) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) @@ -15,17 +15,35 @@ target_include_directories(common INTERFACE ) target_compile_options(common INTERFACE $<$<CONFIG:Debug>: + -O0 -Wall -Wextra -Wpedantic -Werror -fsanitize=address,undefined + -DAPLWC_BUILD_TYPE_DEBUG + > + + $<$<CONFIG:Coverage>: + -O0 + --coverage + -fcondition-coverage + -DAPLWC_BUILD_TYPE_COVERAGE + > + + $<$<CONFIG:Release>: + -DAPLWC_BUILD_TYPE_RELEASE > ) target_link_options(common INTERFACE $<$<CONFIG:Debug>: -fsanitize=address,undefined > + + $<$<CONFIG:Coverage>: + --coverage + -fcondition-coverage + > ) add_library(aplwc @@ -39,3 +57,13 @@ add_executable(aplwc-repl src/main.c ) target_link_libraries(aplwc-repl PRIVATE common aplwc) + +enable_testing() +file(GLOB TEST_SOURCES CONFIGURE_DEPENDS "tests/*.c") +foreach(source ${TEST_SOURCES}) + get_filename_component(name "${source}" NAME_WE) + set(test_bin "testbin-${name}") + add_executable("${test_bin}" "${source}") + target_link_libraries("${test_bin}" PRIVATE common aplwc) + add_test(NAME "${name}" COMMAND "${test_bin}") +endforeach() |