31 lines
786 B
CMake
31 lines
786 B
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(mons_json LANGUAGES C)
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
|
|
add_library(mons_json
|
|
SHARED
|
|
./src/json.c
|
|
)
|
|
|
|
target_include_directories(mons_json PUBLIC
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/include"
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
|
)
|
|
target_compile_options(mons_json PRIVATE -coverage)
|
|
target_link_options(mons_json PRIVATE -coverage)
|
|
target_link_libraries(mons_json PUBLIC mons_collections)
|
|
|
|
include(CTest)
|
|
|
|
function(TESTCASE NAME)
|
|
add_executable(test_${NAME} ./tests/${NAME}.c)
|
|
target_link_libraries(test_${NAME} PUBLIC mons_json)
|
|
add_test(
|
|
NAME ${NAME}
|
|
COMMAND $<TARGET_FILE:test_${NAME}>
|
|
)
|
|
endfunction()
|
|
|