You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. add_executable(test1Formatted test1.c parse_flags.c parse_flags.h)
  2. target_compile_definitions(test1Formatted PRIVATE TEST_FORMATTED=1)
  3. target_link_libraries(test1Formatted PRIVATE ${PROJECT_NAME})
  4. add_executable(test2Formatted test2.c parse_flags.c parse_flags.h)
  5. target_compile_definitions(test2Formatted PRIVATE TEST_FORMATTED=1)
  6. target_link_libraries(test2Formatted PRIVATE ${PROJECT_NAME})
  7. # https://cmake.org/cmake/help/v3.0/command/add_test.html
  8. # https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
  9. include_directories(PUBLIC ${CMAKE_SOURCE_DIR})
  10. foreach(TESTNAME
  11. test1
  12. test2
  13. test4
  14. testReplaceExisting
  15. test_cast
  16. test_charcase
  17. test_compare
  18. test_deep_copy
  19. test_double_serializer
  20. test_float
  21. test_int_add
  22. test_json_pointer
  23. test_locale
  24. test_null
  25. test_parse
  26. test_parse_int64
  27. test_printbuf
  28. test_set_serializer
  29. test_set_value
  30. test_util_file
  31. test_visit)
  32. add_executable(${TESTNAME} ${TESTNAME}.c)
  33. add_test(NAME ${TESTNAME} COMMAND ${PROJECT_SOURCE_DIR}/tests/${TESTNAME}.test)
  34. # XXX using the non-target_ versions of these doesn't work :(
  35. target_include_directories(
  36. ${TESTNAME}
  37. PUBLIC
  38. ${CMAKE_CURRENT_LIST_DIR}
  39. )
  40. target_link_libraries(
  41. ${TESTNAME}
  42. PRIVATE
  43. ${PROJECT_NAME}
  44. )
  45. endforeach(TESTNAME)