2023-09-05 14:27:27 +02:00
|
|
|
cmake_minimum_required(VERSION 3.9)
|
2019-11-23 15:15:48 -05:00
|
|
|
add_executable(test1Formatted test1.c parse_flags.c parse_flags.h)
|
|
|
|
|
target_compile_definitions(test1Formatted PRIVATE TEST_FORMATTED=1)
|
|
|
|
|
target_link_libraries(test1Formatted PRIVATE ${PROJECT_NAME})
|
|
|
|
|
|
|
|
|
|
add_executable(test2Formatted test2.c parse_flags.c parse_flags.h)
|
|
|
|
|
target_compile_definitions(test2Formatted PRIVATE TEST_FORMATTED=1)
|
|
|
|
|
target_link_libraries(test2Formatted PRIVATE ${PROJECT_NAME})
|
|
|
|
|
|
|
|
|
|
# https://cmake.org/cmake/help/v3.0/command/add_test.html
|
|
|
|
|
# https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
|
|
|
|
|
|
|
|
|
|
include_directories(PUBLIC ${CMAKE_SOURCE_DIR})
|
|
|
|
|
|
2021-04-16 09:32:07 +03:00
|
|
|
set(ALL_TEST_NAMES
|
|
|
|
|
test1
|
|
|
|
|
test2
|
|
|
|
|
test4
|
|
|
|
|
testReplaceExisting
|
|
|
|
|
test_cast
|
|
|
|
|
test_charcase
|
|
|
|
|
test_compare
|
|
|
|
|
test_deep_copy
|
|
|
|
|
test_double_serializer
|
|
|
|
|
test_float
|
|
|
|
|
test_int_add
|
2022-11-16 00:49:18 +01:00
|
|
|
test_int_get
|
2021-04-16 09:32:07 +03:00
|
|
|
test_locale
|
|
|
|
|
test_null
|
|
|
|
|
test_parse
|
|
|
|
|
test_parse_int64
|
|
|
|
|
test_printbuf
|
|
|
|
|
test_set_serializer
|
|
|
|
|
test_set_value
|
|
|
|
|
test_strerror
|
|
|
|
|
test_util_file
|
|
|
|
|
test_visit
|
|
|
|
|
test_object_iterator)
|
|
|
|
|
|
2021-04-16 09:42:07 +03:00
|
|
|
if (NOT DISABLE_JSON_POINTER)
|
|
|
|
|
set(ALL_TEST_NAMES ${ALL_TEST_NAMES} test_json_pointer)
|
2021-04-20 15:47:18 +03:00
|
|
|
if (NOT DISABLE_JSON_PATCH)
|
|
|
|
|
set(ALL_TEST_NAMES ${ALL_TEST_NAMES} test_json_patch)
|
|
|
|
|
endif()
|
2021-04-16 09:42:07 +03:00
|
|
|
endif()
|
|
|
|
|
|
2021-04-16 09:32:07 +03:00
|
|
|
foreach(TESTNAME ${ALL_TEST_NAMES})
|
2019-11-23 15:15:48 -05:00
|
|
|
|
|
|
|
|
add_executable(${TESTNAME} ${TESTNAME}.c)
|
|
|
|
|
add_test(NAME ${TESTNAME} COMMAND ${PROJECT_SOURCE_DIR}/tests/${TESTNAME}.test)
|
|
|
|
|
|
|
|
|
|
# XXX using the non-target_ versions of these doesn't work :(
|
|
|
|
|
target_include_directories(
|
|
|
|
|
${TESTNAME}
|
|
|
|
|
PUBLIC
|
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}
|
|
|
|
|
)
|
|
|
|
|
target_link_libraries(
|
|
|
|
|
${TESTNAME}
|
|
|
|
|
PRIVATE
|
|
|
|
|
${PROJECT_NAME}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
endforeach(TESTNAME)
|