CMakeLists.txt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. list(APPEND EXAMPLES
  2. hloop_test
  3. htimer_test
  4. nc
  5. tcp_echo_server
  6. tcp_chat_server
  7. tcp_proxy_server
  8. udp_echo_server
  9. udp_proxy_server
  10. )
  11. include_directories(.. ../base ../util ../event)
  12. add_executable(hloop_test hloop_test.c)
  13. target_link_libraries(hloop_test hv)
  14. add_executable(htimer_test htimer_test.c)
  15. target_link_libraries(htimer_test hv)
  16. add_executable(nc nc.c)
  17. target_link_libraries(nc hv)
  18. add_executable(tcp_echo_server tcp_echo_server.c)
  19. target_link_libraries(tcp_echo_server hv)
  20. add_executable(tcp_chat_server tcp_chat_server.c)
  21. target_link_libraries(tcp_chat_server hv)
  22. add_executable(tcp_proxy_server tcp_proxy_server.c)
  23. target_link_libraries(tcp_proxy_server hv)
  24. add_executable(udp_echo_server udp_echo_server.c)
  25. target_link_libraries(udp_echo_server hv)
  26. add_executable(udp_proxy_server udp_proxy_server.c)
  27. target_link_libraries(udp_proxy_server hv)
  28. if(WITH_EVPP)
  29. include_directories(../cpputil ../evpp)
  30. add_executable(hmain_test hmain_test.cpp)
  31. target_link_libraries(hmain_test hv)
  32. aux_source_directory(nmap NMAP_SRCS)
  33. add_executable(nmap ${NMAP_SRCS})
  34. target_compile_definitions(nmap PRIVATE -DPRINT_DEBUG)
  35. target_link_libraries(nmap hv)
  36. list(APPEND EXAMPLES hmain_test nmap)
  37. if(WITH_HTTP)
  38. include_directories(../http)
  39. if(WITH_HTTP_SERVER)
  40. include_directories(../http/server)
  41. # http_server_test
  42. add_executable(http_server_test http_server_test.cpp)
  43. target_link_libraries(http_server_test hv)
  44. # websocket_server_test
  45. add_executable(websocket_server_test websocket_server_test.cpp)
  46. target_link_libraries(websocket_server_test hv)
  47. list(APPEND EXAMPLES http_server_test websocket_server_test)
  48. endif()
  49. if(WITH_HTTP_CLIENT)
  50. include_directories(../http/client)
  51. # curl
  52. set(CURL_TARGET_NAME curl)
  53. if(WITH_CURL)
  54. set(CURL_TARGET_NAME hv_curl)
  55. endif()
  56. add_executable(${CURL_TARGET_NAME} curl.cpp)
  57. if(WITH_CURL)
  58. set_target_properties(${CURL_TARGET_NAME} PROPERTIES OUTPUT_NAME curl)
  59. endif()
  60. target_link_libraries(${CURL_TARGET_NAME} hv)
  61. # wget
  62. add_executable(wget wget.cpp)
  63. target_link_libraries(wget hv)
  64. # http_client_test
  65. add_executable(http_client_test http_client_test.cpp)
  66. target_link_libraries(http_client_test hv)
  67. # websocket_client_test
  68. add_executable(websocket_client_test websocket_client_test.cpp)
  69. target_link_libraries(websocket_client_test hv)
  70. list(APPEND EXAMPLES ${CURL_TARGET_NAME} wget http_client_test websocket_client_test)
  71. endif()
  72. if(WITH_CONSUL)
  73. include_directories(../consul)
  74. add_executable(consul_cli consul_cli.cpp)
  75. target_compile_definitions(consul_cli PRIVATE PRINT_DEBUG)
  76. target_link_libraries(consul_cli hv)
  77. list(APPEND EXAMPLES consul_cli)
  78. endif()
  79. if(WITH_HTTP_SERVER)
  80. # httpd
  81. aux_source_directory(httpd HTTPD_SRCS)
  82. add_executable(httpd ${HTTPD_SRCS})
  83. target_link_libraries(httpd hv)
  84. list(APPEND EXAMPLES httpd)
  85. endif()
  86. endif()
  87. endif()
  88. add_custom_target(examples DEPENDS ${EXAMPLES})