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