CMakeLists.txt 2.7 KB

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