# # socket/CMakeLists.txt -- # cmake_minimum_required(VERSION 3.1) project(SOCKET C) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") add_definitions(-Wall -Wextra -pedantic -Werror -D_FORTIFY_SOURCE=2) endif() find_package(PkgConfig) pkg_check_modules(LIBEVENT REQUIRED libevent) include_directories(${LIBEVENT_INCLUDE_DIRS}) link_directories(${LIBEVENT_LIBRARY_DIRS}) add_executable(showip showip.c) add_executable(chat chat.c) add_executable(chatd chatd.c clnt.c clnt-event.c) add_library(tcp tcp-connect.c tcp-listen.c tcp-accept.c tcp-read.c tcp-write.c tcp-read-write.c tcp-chat.c tcp-close.c) add_library(udp udp-connect.c udp-socket.c udp-recv-write.c udp-read-send.c udp-chat.c udp-close.c) target_link_libraries(chat tcp udp) target_link_libraries(chatd tcp udp ${LIBEVENT_LIBRARIES})