C reference parsing library for eno notation
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.

79 lines
2.1 KiB

  1. cmake_minimum_required(VERSION 3.1...3.13)
  2. if(${CMAKE_VERSION} VERSION_LESS 3.12)
  3. cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
  4. endif()
  5. project(eno VERSION 0.1
  6. DESCRIPTION "C library for parsing eno notation"
  7. LANGUAGES C)
  8. set(CMAKE_C_STANDARD 90)
  9. if(MSVC)
  10. add_compile_options(/W4 /WX)
  11. else()
  12. add_compile_options(-Wall -Wextra -pedantic -Werror)
  13. endif()
  14. # Uncomment for gdb symbol table generation
  15. # set(CMAKE_BUILD_TYPE Debug)
  16. # Uncomment for leak detection/segfault troubleshooting
  17. # set(CMAKE_C_FLAGS "-fsanitize=address")
  18. # ICU dependency
  19. # --------------
  20. find_package(PkgConfig REQUIRED)
  21. pkg_check_modules(ICU_IO REQUIRED IMPORTED_TARGET icu-io)
  22. pkg_check_modules(ICU_UC REQUIRED IMPORTED_TARGET icu-uc)
  23. # Main library target: libeno
  24. # ---------------------------
  25. add_library(eno STATIC lib/compare.c
  26. lib/debug.c
  27. lib/error.c
  28. lib/free.c
  29. lib/get.c
  30. lib/iterate.c
  31. lib/parse.c
  32. lib/query.c
  33. lib/read.c
  34. lib/resolve.c)
  35. target_include_directories(eno PUBLIC include)
  36. # Test binary target: test_examples
  37. # ------------------------------
  38. add_executable(test_examples test/examples.c
  39. test/serialize_external_ast.c
  40. test/serialize_internal_ast.c)
  41. target_link_libraries(test_examples PUBLIC eno)
  42. target_link_libraries(test_examples PUBLIC PkgConfig::ICU_IO)
  43. target_link_libraries(test_examples PUBLIC PkgConfig::ICU_UC)
  44. # Test binary target: test_get
  45. # ------------------------------
  46. add_executable(test_get test/get.c)
  47. target_link_libraries(test_get PUBLIC eno)
  48. target_link_libraries(test_get PUBLIC PkgConfig::ICU_IO)
  49. target_link_libraries(test_get PUBLIC PkgConfig::ICU_UC)
  50. # Test binary target: test_parse
  51. # ------------------------------
  52. add_executable(test_parse test/parse.c)
  53. target_link_libraries(test_parse PUBLIC eno)
  54. target_link_libraries(test_parse PUBLIC PkgConfig::ICU_IO)
  55. target_link_libraries(test_parse PUBLIC PkgConfig::ICU_UC)