From dbc96093b98bea3fa2d01c7c16597531582a5ffe Mon Sep 17 00:00:00 2001 From: wxd237 Date: Fri, 2 Feb 2018 15:55:03 +0800 Subject: [PATCH 1/2] cmake --- CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..007b778 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +project(tcpdaemon) +cmake_minimum_required(VERSION 2.8) + +SET(LIBSRC +src/tcpdaemon_lib.c +src/LOGC.c +src/list.c +src/rbtree_ins.c +src/rbtree.c + +) + +add_library(tcpdaemon_s STATIC ${LIBSRC}) +set_target_properties(tcpdaemon_s PROPERTIES OUTPUT_NAME tcpdaemon ) +INSTALL(TARGETS tcpdaemon_s DESTINATION lib) + +add_executable(tcpdaemon src/tcpdaemon_main.c) +target_link_libraries(tcpdaemon tcpdaemon_s dl) +INSTALL(TARGETS tcpdaemon DESTINATION bin) + + +INSTALL(FILES src/tcpdaemon.h DESTINATION include) + +include(InstallRequiredSystemLibraries) + +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "0") +set(CPACK_GENERATOR "TGZ") +set(CPACK_PACKAGE_NAME tcpdaemon) +INCLUDE(CPack) + -- Gitee From 0056d2f66130035722f84e5fcadb374c7125b4a2 Mon Sep 17 00:00:00 2001 From: wxd237 Date: Fri, 2 Feb 2018 17:01:38 +0800 Subject: [PATCH 2/2] cmake add subdirectory test --- CMakeLists.txt | 2 ++ test/CMakeLists.txt | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 007b778..e34d53e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,8 @@ INSTALL(TARGETS tcpdaemon DESTINATION bin) INSTALL(FILES src/tcpdaemon.h DESTINATION include) +add_subdirectory(test) + include(InstallRequiredSystemLibraries) set(CPACK_PACKAGE_VERSION_MAJOR "1") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..05106a1 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(test_main_IOMP test_main_IOMP.c test_callback_http_echo_nonblock.c) +target_link_libraries(test_main_IOMP tcpdaemon_s dl) + + -- Gitee