CMakeLists.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. cmake_minimum_required(VERSION 2.8)
  2. SET (CUSTOM_BINARY_OUTPUT_DIR bin)
  3. SET (DOC_OUTPUT doc/)
  4. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra")
  5. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
  6. # Add ncurses
  7. SET(CURSES_NEED_NCURSES TRUE)
  8. find_package(Curses)
  9. include_directories(include ${CURSES_INCLUDE_DIRS})
  10. # jsonstroll
  11. add_executable(jsonstroll
  12. src/main.cpp
  13. src/warning.cpp
  14. src/params.cpp
  15. src/curseOutput.cpp
  16. src/curseSimpleOutput.cpp
  17. src/curseSplitOutput.cpp
  18. src/linearHistory.cpp
  19. src/outputFlag.cpp
  20. src/streamConsumer.cpp
  21. src/searchPattern.cpp
  22. src/jsonElement.cpp
  23. src/jsonArray.cpp
  24. src/jsonObject.cpp
  25. src/jsonContainer.cpp
  26. src/jsonObjectEntry.cpp
  27. src/jsonPrimitive.cpp
  28. src/jsonException.cpp
  29. src/except.cpp
  30. )
  31. set_property(TARGET jsonstroll PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CUSTOM_BINARY_OUTPUT_DIR})
  32. target_link_libraries(jsonstroll ${ncurses++_LIBRARIES} ${CURSES_LIBRARIES})
  33. # Add tests
  34. enable_testing()
  35. add_executable(json_test
  36. test/src/main.cpp
  37. src/jsonContainer.cpp
  38. src/warning.cpp
  39. src/linearHistory.cpp
  40. src/searchPattern.cpp
  41. src/streamConsumer.cpp
  42. src/jsonArray.cpp
  43. src/jsonObjectEntry.cpp
  44. src/jsonObject.cpp
  45. src/jsonElement.cpp
  46. src/jsonPrimitive.cpp
  47. src/jsonException.cpp
  48. )
  49. set_property(
  50. TARGET json_test
  51. PROPERTY RUNTIME_OUTPUT_DIRECTORY test
  52. )
  53. add_executable(wrapped_test
  54. test/src/wrapped.cpp
  55. )
  56. add_test(json_test test/json_test)
  57. set_property(
  58. TARGET wrapped_test
  59. PROPERTY RUNTIME_OUTPUT_DIRECTORY test
  60. )
  61. add_test(wrapped_test test/wrapped_test)
  62. # Add manual page
  63. find_program (HELP2MAN help2man)
  64. add_custom_target(man ALL)
  65. if (HELP2MAN)
  66. add_definitions(
  67. -DVERSIONDATE=__DATE__
  68. )
  69. add_custom_target(
  70. TARGET man ALL
  71. COMMAND ${CMAKE_COMMAND} -E make_directory ${DOC_OUTPUT}
  72. )
  73. add_custom_command(
  74. TARGET man
  75. SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${CUSTOM_BINARY_OUTPUT_DIR}/jsonstroll
  76. COMMAND help2man ${CMAKE_CURRENT_BINARY_DIR}/${CUSTOM_BINARY_OUTPUT_DIR}/jsonstroll -o ${DOC_OUTPUT}/jsonstroll.1
  77. OUTPUTS ${DOC_OUTPUT}/jsonstroll.1
  78. )
  79. add_custom_command(
  80. TARGET man
  81. SOURCE man
  82. DEPENDS ${DOC_OUTPUT}/jsonstroll.1
  83. )
  84. endif()
  85. # Install
  86. install(
  87. TARGETS jsonstroll
  88. DESTINATION bin
  89. )
  90. install(
  91. FILES ${DOC_OUTPUT}/jsonstroll.1
  92. DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1
  93. )