CMakeLists.txt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 ../event ../utils)
  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. list(APPEND EXAMPLES httpd http_server_test)
  44. endif()
  45. if(WITH_HTTP_CLIENT)
  46. include_directories(../http/client)
  47. # curl
  48. set(CURL_TARGET_NAME curl)
  49. if(WITH_CURL)
  50. set(CURL_TARGET_NAME hv_curl)
  51. endif()
  52. add_executable(${CURL_TARGET_NAME} curl.cpp)
  53. if(WITH_CURL)
  54. set_target_properties(${CURL_TARGET_NAME} PROPERTIES OUTPUT_NAME curl)
  55. endif()
  56. target_link_libraries(${CURL_TARGET_NAME} hv)
  57. # http_client_test
  58. add_executable(http_client_test http_client_test.cpp)
  59. target_link_libraries(http_client_test hv)
  60. list(APPEND EXAMPLES ${CURL_TARGET_NAME} http_client_test)
  61. endif()
  62. if(WITH_CONSUL)
  63. include_directories(../consul)
  64. add_executable(consul_cli consul_cli.cpp)
  65. target_compile_definitions(consul_cli PRIVATE PRINT_DEBUG)
  66. target_link_libraries(consul_cli hv)
  67. list(APPEND EXAMPLES consul_cli)
  68. endif()
  69. endif()
  70. add_custom_target(examples DEPENDS ${EXAMPLES})