CMakeLists.txt 1.9 KB

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