CMakeLists.txt revision f07b3eae
106b2a236SDmitri Tikhonov# Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc.  See LICENSE.
2b54d1e63SDmitri TikhonovLIST(APPEND LIBS ${EVENT_LIB})
3b54d1e63SDmitri Tikhonov
4b54d1e63SDmitri TikhonovIF(MSVC)
5b54d1e63SDmitri Tikhonov    FIND_LIBRARY(PCRE_LIB pcre)
6b54d1e63SDmitri Tikhonov    IF(PCRE_LIB)
7b54d1e63SDmitri Tikhonov        MESSAGE(STATUS "Found pcre: ${PCRE_LIB}")
8b54d1e63SDmitri Tikhonov        LIST(APPEND LIBS ${PCRE_LIB})
9b54d1e63SDmitri Tikhonov    ELSE()
10b54d1e63SDmitri Tikhonov        MESSAGE(STATUS "pcre not found: http_server won't work")
11b54d1e63SDmitri Tikhonov    ENDIF()
12b54d1e63SDmitri Tikhonov    FIND_LIBRARY(PCREPOSIX_LIB pcreposix)
13b54d1e63SDmitri Tikhonov    IF(PCREPOSIX_LIB)
14b54d1e63SDmitri Tikhonov        MESSAGE(STATUS "Found pcreposix: ${PCREPOSIX_LIB}")
15b54d1e63SDmitri Tikhonov        LIST(APPEND LIBS ${PCREPOSIX_LIB})
16b54d1e63SDmitri Tikhonov    ELSE()
17b54d1e63SDmitri Tikhonov        MESSAGE(STATUS "pcreposix not found: http_server won't work")
18b54d1e63SDmitri Tikhonov    ENDIF()
19b54d1e63SDmitri Tikhonov    LIST(APPEND LIBS ws2_32)
20b54d1e63SDmitri Tikhonov    LIST(APPEND LIBS iphlpapi)
21f07b3eaeSTyler Young    LIST(APPEND LIBS ${GETOPT_LIB})
22b54d1e63SDmitri TikhonovENDIF()
23b54d1e63SDmitri Tikhonov
24f07b3eaeSTyler Youngadd_executable(http_server http_server.c prog.c test_common.c test_cert.c)
25b54d1e63SDmitri TikhonovIF(NOT MSVC)   #   TODO: port MD5 server and client to Windows
26f07b3eaeSTyler Youngadd_executable(md5_server md5_server.c prog.c test_common.c test_cert.c)
27f07b3eaeSTyler Youngadd_executable(md5_client md5_client.c prog.c test_common.c test_cert.c)
28b54d1e63SDmitri TikhonovENDIF()
29f07b3eaeSTyler Youngadd_executable(echo_server echo_server.c prog.c test_common.c test_cert.c)
30f07b3eaeSTyler Youngadd_executable(echo_client echo_client.c prog.c test_common.c test_cert.c)
31f07b3eaeSTyler Youngadd_executable(duck_server duck_server.c prog.c test_common.c test_cert.c)
32f07b3eaeSTyler Youngadd_executable(duck_client duck_client.c prog.c test_common.c test_cert.c)
33f07b3eaeSTyler Youngadd_executable(perf_client perf_client.c prog.c test_common.c test_cert.c)
34f07b3eaeSTyler Youngadd_executable(perf_server perf_server.c prog.c test_common.c test_cert.c)
35b54d1e63SDmitri Tikhonov
36b54d1e63SDmitri Tikhonov
37b54d1e63SDmitri TikhonovIF (NOT MSVC)
38b54d1e63SDmitri Tikhonov
39b54d1e63SDmitri Tikhonovadd_executable(http_client
40b54d1e63SDmitri Tikhonov    http_client.c
41b54d1e63SDmitri Tikhonov    prog.c
42b54d1e63SDmitri Tikhonov    test_common.c
43b54d1e63SDmitri Tikhonov    test_cert.c
44b54d1e63SDmitri Tikhonov)
45b54d1e63SDmitri Tikhonov
46b54d1e63SDmitri Tikhonov#MSVC
47b54d1e63SDmitri TikhonovELSE()
48b54d1e63SDmitri Tikhonov
49b54d1e63SDmitri Tikhonovadd_executable(http_client
50b54d1e63SDmitri Tikhonov    http_client.c
51b54d1e63SDmitri Tikhonov    prog.c
52b54d1e63SDmitri Tikhonov    test_common.c
53b54d1e63SDmitri Tikhonov    test_cert.c
54b54d1e63SDmitri Tikhonov)
55b54d1e63SDmitri Tikhonov
56b54d1e63SDmitri TikhonovENDIF()
57b54d1e63SDmitri Tikhonov
58b54d1e63SDmitri TikhonovTARGET_LINK_LIBRARIES(http_client ${LIBS})
59b54d1e63SDmitri TikhonovTARGET_LINK_LIBRARIES(http_server ${LIBS})
60b54d1e63SDmitri TikhonovIF(NOT MSVC)
61b54d1e63SDmitri TikhonovTARGET_LINK_LIBRARIES(md5_server  ${LIBS})
62b54d1e63SDmitri TikhonovTARGET_LINK_LIBRARIES(md5_client  ${LIBS})
63b54d1e63SDmitri TikhonovENDIF()
64b54d1e63SDmitri TikhonovTARGET_LINK_LIBRARIES(echo_server ${LIBS})
65b54d1e63SDmitri TikhonovTARGET_LINK_LIBRARIES(echo_client ${LIBS})
66b54d1e63SDmitri TikhonovTARGET_LINK_LIBRARIES(duck_server ${LIBS})
67b54d1e63SDmitri TikhonovTARGET_LINK_LIBRARIES(duck_client ${LIBS})
688ecb980dSDmitri TikhonovTARGET_LINK_LIBRARIES(perf_client ${LIBS})
698ecb980dSDmitri TikhonovTARGET_LINK_LIBRARIES(perf_server ${LIBS})
70b54d1e63SDmitri Tikhonov
71b54d1e63SDmitri Tikhonov
725392f7a3SLiteSpeed TechINCLUDE(CheckFunctionExists)
735392f7a3SLiteSpeed TechCHECK_FUNCTION_EXISTS(sendmmsg HAVE_SENDMMSG)
745392f7a3SLiteSpeed TechCHECK_FUNCTION_EXISTS(recvmmsg HAVE_RECVMMSG)
755392f7a3SLiteSpeed TechCHECK_FUNCTION_EXISTS(open_memstream HAVE_OPEN_MEMSTREAM)
765392f7a3SLiteSpeed Tech
7750aadb33SDmitri Tikhonov
78e0197994SDmitri TikhonovINCLUDE(CheckSymbolExists)
79e0197994SDmitri Tikhonov
80e0197994SDmitri TikhonovCHECK_SYMBOL_EXISTS(
81e0197994SDmitri Tikhonov    IP_MTU_DISCOVER
82e0197994SDmitri Tikhonov    "netinet/in.h"
83e0197994SDmitri Tikhonov    HAVE_IP_MTU_DISCOVER
84e0197994SDmitri Tikhonov)
85e0197994SDmitri Tikhonov
86e0197994SDmitri TikhonovCHECK_SYMBOL_EXISTS(
87e0197994SDmitri Tikhonov    IP_DONTFRAG
88e0197994SDmitri Tikhonov    "netinet/in.h"
89e0197994SDmitri Tikhonov    HAVE_IP_DONTFRAG
90e0197994SDmitri Tikhonov)
91e0197994SDmitri Tikhonov
92c3c69ba3SDmitri TikhonovCHECK_SYMBOL_EXISTS(
93c3c69ba3SDmitri Tikhonov    preadv
94c3c69ba3SDmitri Tikhonov    "sys/uio.h"
95c3c69ba3SDmitri Tikhonov    HAVE_PREADV
96c3c69ba3SDmitri Tikhonov)
97c3c69ba3SDmitri Tikhonov
985dc94445SDmitri TikhonovINCLUDE(CheckIncludeFiles)
995dc94445SDmitri Tikhonov
100fb3e20e0SDmitri TikhonovIF (MSVC AND PCRE_LIB)
101fb3e20e0SDmitri TikhonovFIND_PATH(EVENT_INCLUDE_DIR NAMES pcreposix.h)
102fb3e20e0SDmitri TikhonovIF (EVENT_INCLUDE_DIR)
103fb3e20e0SDmitri Tikhonov    MESSAGE(STATUS "found pcreposix.h")
104fb3e20e0SDmitri Tikhonov    SET(HAVE_REGEX 1)
105fb3e20e0SDmitri TikhonovELSE()
106fb3e20e0SDmitri Tikhonov    MESSAGE(FATAL_ERROR "event2/event.h was not found")
107fb3e20e0SDmitri TikhonovENDIF()
108fb3e20e0SDmitri TikhonovELSE()
1095dc94445SDmitri TikhonovCHECK_INCLUDE_FILES(regex.h HAVE_REGEX)
110fb3e20e0SDmitri TikhonovENDIF()
111e0197994SDmitri Tikhonov
112e0197994SDmitri TikhonovCONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test_config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/test_config.h)
113