Flesh out the repository with example and tests

This commit is contained in:
ktkk 2025-10-09 15:07:32 +00:00
parent 546eaa5d4d
commit 05c45bbc81
8 changed files with 165 additions and 57 deletions

View file

@ -6,13 +6,34 @@ project(
C
)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
add_executable(
add_library(
${PROJECT_NAME}
main.c
json.c
)
target_include_directories(
${PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
C_STANDARD 23
C_STANDARD_REQUIRED ON
C_EXTENSIONS OFF
)
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
install(FILES json.h DESTINATION include)
option(BUILD_EXAMPLE "Build the example" OFF)
if(BUILD_EXAMPLE)
add_subdirectory(example)
endif()
option(BUILD_TESTS "Build unit tests" OFF)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()