Simple XML subset parser comparable to glib's Markup parser, but without any dependencies in one self contained file. Forked from https://github.com/ooxi/xml.c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
1.8 KiB

  1. # xml.c / test
  2. cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
  3. # Example
  4. add_executable(
  5. "${PROJECT_NAME}-example"
  6. "${CMAKE_CURRENT_LIST_DIR}/example.c"
  7. )
  8. target_compile_options(
  9. "${PROJECT_NAME}-example"
  10. PRIVATE
  11. -std=c11
  12. )
  13. target_link_libraries(
  14. "${PROJECT_NAME}-example"
  15. PRIVATE
  16. xml
  17. )
  18. add_test(
  19. NAME "${PROJECT_NAME}-example"
  20. COMMAND "${PROJECT_NAME}-example"
  21. )
  22. # Test case
  23. FILE( COPY "${CMAKE_CURRENT_LIST_DIR}/test.xml"
  24. DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
  25. )
  26. # Test (C)
  27. add_executable(
  28. "${PROJECT_NAME}-test-c"
  29. "${CMAKE_CURRENT_LIST_DIR}/test-xml-c.c"
  30. )
  31. target_compile_options(
  32. "${PROJECT_NAME}-test-c"
  33. PRIVATE
  34. -std=c11
  35. )
  36. target_link_libraries(
  37. "${PROJECT_NAME}-test-c"
  38. PRIVATE
  39. xml
  40. )
  41. add_test(
  42. NAME "${PROJECT_NAME}-test-c"
  43. COMMAND "${PROJECT_NAME}-test-c"
  44. )
  45. add_test(
  46. NAME "${PROJECT_NAME}-test-c-valgrind"
  47. COMMAND valgrind --tool=memcheck --leak-check=full --track-origins=yes -v "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-test-c"
  48. )
  49. # Test (C++)
  50. add_executable(
  51. "${PROJECT_NAME}-test-cpp"
  52. "${CMAKE_CURRENT_LIST_DIR}/test-xml-cpp.cpp"
  53. )
  54. target_compile_options(
  55. "${PROJECT_NAME}-test-cpp"
  56. PRIVATE
  57. -std=c++11
  58. )
  59. target_link_libraries(
  60. "${PROJECT_NAME}-test-cpp"
  61. PRIVATE
  62. xml
  63. )
  64. add_test(
  65. NAME "${PROJECT_NAME}-test-cpp"
  66. COMMAND "${PROJECT_NAME}-test-cpp"
  67. )
  68. add_test(
  69. NAME "${PROJECT_NAME}-test-cpp-valgrind"
  70. COMMAND valgrind --tool=memcheck --leak-check=full --track-origins=yes -v "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-test-cpp"
  71. )
  72. # Test huitre39
  73. add_executable(
  74. "${PROJECT_NAME}-test-huitre39"
  75. "${CMAKE_CURRENT_LIST_DIR}/test-huitre39.c"
  76. )
  77. target_compile_options(
  78. "${PROJECT_NAME}-test-huitre39"
  79. PRIVATE
  80. -std=c11
  81. )
  82. target_link_libraries(
  83. "${PROJECT_NAME}-test-huitre39"
  84. PRIVATE
  85. xml
  86. )
  87. add_test(
  88. NAME "${PROJECT_NAME}-test-huitre39"
  89. COMMAND "${PROJECT_NAME}-test-huitre39"
  90. )