File: CMakeLists.txt

package info (click to toggle)
pound 3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 536 kB
  • sloc: ansic: 5,065; sh: 42; makefile: 14
file content (80 lines) | stat: -rw-r--r-- 2,691 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# tunable variables - regenerate pound.h for it to take effect
set (VERSION "3.0")
set (MAXBUF 8192)
set (MAXHEADERS 128)
set (RESURRECT_CYCLE 60)
set (RESURRECT_TO 15)
set (HASH_FUNCTION HASH_FNV)
set (LOG_FACILITY LOG_DAEMON)
set (H2TABSIZE 4096)
set (H2FRAMESIZE 16384)

# from here on there should be nothing to change
cmake_minimum_required(VERSION 3.0)
project(Pound C)

if (CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GCC" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result -Wno-cast-qual -Wno-discarded-qualifiers -D_GNU_SOURCE -O2")
endif()

include_directories(include)

file(GLOB SOURCES "src/*.c")

add_executable(pound ${SOURCES})

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)

include(CheckIncludeFiles)
CHECK_INCLUDE_FILES("stdio.h;pthread.h;yaml.h;nanomsg/nn.h;nanomsg/inproc.h;nanomsg/pipeline.h;nanomsg/pair.h;nanomsg/reqrep.h;stdlib.h;unistd.h;fcntl.h;ctype.h;getopt.h;string.h;syslog.h;sys/types.h;sys/socket.h;netdb.h;sys/stat.h;time.h;poll.h;semaphore.h;pwd.h;grp.h;signal.h;setjmp.h;mbedtls/config.h;mbedtls/certs.h;mbedtls/oid.h;mbedtls/asn1.h;mbedtls/x509.h;mbedtls/entropy.h;mbedtls/ctr_drbg.h;mbedtls/ssl.h;mbedtls/error.h" HAVE_MANDATORY_INCLUDES LANGUAGE C)
if(NOT HAVE_MANDATORY_INCLUDES)
message(FATAL_ERROR "Missing mandatory header files!")
endif()

CHECK_INCLUDE_FILES(pcreposix.h HAVE_PCREPOSIX_H)
CHECK_INCLUDE_FILES(pcre/pcreposix.h HAVE_PCRE_PCREPOSIX_H)
CHECK_INCLUDE_FILES(regex.h HAVE_REGEX_H)
CHECK_INCLUDE_FILES(stdarg.h HAVE_STDARG_H)

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/include/pound.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/pound.h)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/MKDIST.in ${CMAKE_CURRENT_SOURCE_DIR}/MKDIST)

target_link_libraries(pound -lyaml)
target_link_libraries(pound -lnanomsg)
target_link_libraries(pound -lpthread)
target_link_libraries(pound Threads::Threads)

FIND_LIBRARY(TCMALLOC tcmalloc )
if(TCMALLOC)
target_link_libraries(pound -ltcmalloc)
endif()

FIND_LIBRARY(MBEDCRYPTO mbedcrypto)
if(MBEDCRYPTO)
target_link_libraries(pound -lmbedcrypto)
endif()

FIND_LIBRARY(MBEDX509 mbedx509)
if(MBEDX509)
target_link_libraries(pound -lmbedx509)
endif()

FIND_LIBRARY(MBEDTLS mbedtls)
if(MBEDTLS)
target_link_libraries(pound -lmbedtls)
endif()

if(NOT MBEDCRYPTO OR NOT MBEDX509 OR NOT MBEDTLS)
message(FATAL_ERROR "Missing mandatory library MbedTLS!")
endif()

if(HAVE_PCREPOSIX_H OR HAVE_PCRE_PCREPOSIX_H)
FIND_LIBRARY(PCRE pcreposix)
if(PCRE)
target_link_libraries(pound -lpcreposix)
else()
message(FATAL_ERROR "pcreposix.h found but libpcreposix is not available!")
endif()
endif()