summaryrefslogtreecommitdiffstats
path: root/lib/CMakeLists.txt
blob: f2aa2e5f2ae54e72900050cb3608ed1b9b8ddaa5 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Librspamdclient
SET(LIBRSPAMDSRC			  client/librspamdclient.c ../src/mem_pool.c ../src/upstream.c ../src/printf.c)

ADD_LIBRARY(rspamdclient SHARED ${LIBRSPAMDSRC})
ADD_LIBRARY(rspamdclient_static STATIC ${LIBRSPAMDSRC})
SET_TARGET_PROPERTIES(rspamdclient PROPERTIES PUBLIC_HEADER "client/librspamdclient.h")

IF(CMAKE_COMPILER_IS_GNUCC)
SET_TARGET_PROPERTIES(rspamdclient PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing")
SET_TARGET_PROPERTIES(rspamdclient_static PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing")
ENDIF(CMAKE_COMPILER_IS_GNUCC)

TARGET_LINK_LIBRARIES(rspamdclient ${CMAKE_REQUIRED_LIBRARIES})
TARGET_LINK_LIBRARIES(rspamdclient pcre)
TARGET_LINK_LIBRARIES(rspamdclient ${GLIB2_LIBRARIES})

TARGET_LINK_LIBRARIES(rspamdclient_static ${CMAKE_REQUIRED_LIBRARIES})
TARGET_LINK_LIBRARIES(rspamdclient_static ${GLIB2_LIBRARIES})

SET_TARGET_PROPERTIES(rspamdclient PROPERTIES VERSION ${RSPAMD_VERSION})
SET_TARGET_PROPERTIES(rspamdclient_static PROPERTIES VERSION ${RSPAMD_VERSION})

IF(GLIB_COMPAT)
	INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/contrib/lgpl")
	TARGET_LINK_LIBRARIES(rspamdclient glibadditions)
ENDIF(GLIB_COMPAT)

INSTALL(TARGETS rspamdclient rspamdclient_static LIBRARY PUBLIC_HEADER 
    LIBRARY DESTINATION lib 
    PUBLIC_HEADER DESTINATION include
    ARCHIVE DESTINATION lib)

    
# Librspamdserver
SET(RSPAMDLIBSRC ../src/binlog.c
                ../src/bloom.c
				../src/buffer.c
				../src/cfg_utils.c
				../src/cfg_xml.c
				../src/diff.c
				../src/dns.c
				../src/events.c
				../src/expressions.c
				../src/filter.c
				../src/fstring.c
				../src/fuzzy.c
				../src/hash.c
				../src/html.c
				../src/images.c
				../src/kvstorage.c
				../src/kvstorage_config.c
				../src/kvstorage_file.c
				../src/lmtp_proto.c
				../src/logger.c
				../src/map.c
				../src/memcached.c
				../src/mem_pool.c
				../src/message.c
				../src/printf.c
				../src/protocol.c
				../src/radix.c
				../src/settings.c
				../src/spf.c
				../src/smtp_proto.c
				../src/smtp_utils.c
				../src/statfile.c
				../src/statfile_sync.c
				../src/symbols_cache.c
				../src/trie.c
				../src/upstream.c
				../src/url.c
				../src/util.c
				../src/view.c)

IF(WITH_DB)
	LIST(APPEND RSPAMDLIBSRC ../src/kvstorage_bdb.c)
ENDIF(WITH_DB)
IF(WITH_SQLITE)
	LIST(APPEND RSPAMDLIBSRC ../src/kvstorage_sqlite.c)
ENDIF(WITH_SQLITE)
				
ADD_LIBRARY(rspamdserver STATIC ${RSPAMDLIBSRC})
SET_TARGET_PROPERTIES(rspamdserver PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(rspamdserver PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB")
TARGET_LINK_LIBRARIES(rspamdserver rspamd_lua)
TARGET_LINK_LIBRARIES(rspamdserver rspamd_json)
TARGET_LINK_LIBRARIES(rspamdserver rspamd_cdb)   


# Libkvstorageclient
SET(LIBRKVSTORAGESRC			  kvstorage/libkvstorageclient.c ../src/mem_pool.c ../src/upstream.c ../src/printf.c ../src/util.c)

ADD_LIBRARY(kvstorageclient SHARED ${LIBRKVSTORAGESRC})
ADD_LIBRARY(kvstorageclient_static STATIC ${LIBRKVSTORAGESRC})
SET_TARGET_PROPERTIES(kvstorageclient PROPERTIES PUBLIC_HEADER "kvstorage/libkvstorageclient.h")

IF(CMAKE_COMPILER_IS_GNUCC)
SET_TARGET_PROPERTIES(kvstorageclient PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing")
SET_TARGET_PROPERTIES(kvstorageclient_static PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing")
ENDIF(CMAKE_COMPILER_IS_GNUCC)

TARGET_LINK_LIBRARIES(kvstorageclient ${CMAKE_REQUIRED_LIBRARIES})
TARGET_LINK_LIBRARIES(kvstorageclient pcre)
TARGET_LINK_LIBRARIES(kvstorageclient ${GLIB2_LIBRARIES})

TARGET_LINK_LIBRARIES(kvstorageclient_static ${CMAKE_REQUIRED_LIBRARIES})
TARGET_LINK_LIBRARIES(kvstorageclient_static ${GLIB2_LIBRARIES})

SET_TARGET_PROPERTIES(kvstorageclient PROPERTIES VERSION ${RSPAMD_VERSION})
SET_TARGET_PROPERTIES(kvstorageclient_static PROPERTIES VERSION ${RSPAMD_VERSION})

IF(GLIB_COMPAT)
	INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/contrib/lgpl")
	TARGET_LINK_LIBRARIES(kvstorageclient glibadditions)
ENDIF(GLIB_COMPAT)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/src")

INSTALL(TARGETS rspamdclient rspamdclient_static LIBRARY PUBLIC_HEADER 
    LIBRARY DESTINATION lib 
    PUBLIC_HEADER DESTINATION include
    ARCHIVE DESTINATION lib)