json/tests/CMakeLists.txt
2025-10-10 15:05:32 +00:00

41 lines
826 B
CMake

include(FetchContent)
FetchContent_Declare(
Unity
GIT_REPOSITORY https://github.com/ThrowTheSwitch/Unity.git
GIT_TAG v2.6.1
)
FetchContent_MakeAvailable(Unity)
list(
APPEND JSON_TESTS
json_tests_simple
json_tests_array
)
foreach(JSON_TEST IN LISTS JSON_TESTS)
add_executable(
${JSON_TEST}
${JSON_TEST}.c
)
set_target_properties(
${JSON_TEST}
PROPERTIES
C_STANDARD 23
C_STANDARD_REQUIRED ON
C_EXTENSIONS OFF
)
target_link_libraries(
${JSON_TEST}
PRIVATE
json
unity::framework
)
target_include_directories(
${JSON_TEST}
PRIVATE
${CMAKE_SOURCE_DIR}
)
add_test(NAME ${JSON_TEST} COMMAND ${JSON_TEST})
endforeach()