aboutsummaryrefslogtreecommitdiff
path: root/lib/CMakeLists.txt
blob: 7e55c7d79260d0a65e7d61a5e0e1fe912dfb8390 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
SET(LIB_NAME libcurl)

CONFIGURE_FILE(${CURL_SOURCE_DIR}/include/curl/curlbuild.h.cmake
  ${CURL_BINARY_DIR}/include/curl/curlbuild.h)
CONFIGURE_FILE(config.h.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/config.h)

SET(libCurl_HEADERS
	${CMAKE_CURRENT_BINARY_DIR}/config.h
	${CURL_BINARY_DIR}/include/curl/curlbuild.h
	arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h
	progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h
	if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h
	getinfo.h strequal.h krb4.h memdebug.h http_chunks.h
	strtok.h connect.h llist.h hash.h content_encoding.h share.h
	curl_md5.h http_digest.h http_negotiate.h http_ntlm.h inet_pton.h
	strtoofft.h strerror.h inet_ntop.h curlx.h memory.h setup.h
	transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h
	tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h
	curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h
)

SET(libCurl_SRCS
  #  amigaos.c - does not build on AmigaOS
  base64.c
  connect.c
  content_encoding.c
  cookie.c
  curl_addrinfo.c
  curl_sspi.c
  dict.c
  easy.c
  escape.c
  file.c
  formdata.c
  ftp.c
  getenv.c
  getinfo.c
  gtls.c
  hash.c
  hostares.c
  hostasyn.c
  hostip4.c
  hostip6.c
  hostip.c
  hostsyn.c
  hostthre.c
  http.c
  http_chunks.c
  http_digest.c
  http_negotiate.c
  http_ntlm.c
  if2ip.c
  inet_ntop.c
  inet_pton.c
  krb4.c
  ldap.c
  llist.c
  md5.c
#  memdebug.c -not used
  mprintf.c
  multi.c
  netrc.c
  # nwlib.c - Not used
  parsedate.c
  progress.c
  rawstr.c
  security.c
  select.c
  sendf.c
  slist.c
  share.c
  socks.c
  speedcheck.c
  splay.c
  ssh.c
  sslgen.c
  ssluse.c
  strdup.c
  strequal.c
  strerror.c
  # strtok.c - specify later
  # strtoofft.c - specify later
  telnet.c
  tftp.c
  timeval.c
  transfer.c
  url.c
  version.c
)

IF(MSVC)
	LIST(APPEND libCurl_SRCS libcurl.rc)
ENDIF()

# if we have Kerberos 4, right now this is never on
#OPTION(CURL_KRB4 "Use Kerberos 4" OFF)
IF(CURL_KRB4)
  SET(libCurl_SRCS ${libCurl_SRCS}
    krb4.c
    security.c
    )
ENDIF(CURL_KRB4)

#OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF)
MARK_AS_ADVANCED(CURL_MALLOC_DEBUG)
IF(CURL_MALLOC_DEBUG)
  SET(libCurl_SRCS ${libCurl_SRCS}
    memdebug.c
    )
ENDIF(CURL_MALLOC_DEBUG)

IF(HAVE_FEATURES_H)
  SET_SOURCE_FILES_PROPERTIES(
    cookie.c
    easy.c
    formdata.c
    getenv.c
    hash.c
    http.c
    if2ip.c 
    mprintf.c
    multi.c
    sendf.c
    telnet.c
    transfer.c
    url.c
    COMPILE_FLAGS -D_BSD_SOURCE)
ENDIF(HAVE_FEATURES_H)

#strtoll \
#socket \
#select \
#strdup \
#strstr \
#strtok_r \
#uname \
#strcasecmp \
#stricmp \
#strcmpi \
#gethostbyaddr \
#gettimeofday \
#inet_addr \
#inet_ntoa \
#inet_pton \
#perror \
#closesocket \
#siginterrupt \
#sigaction \
#signal \
#getpass_r \
#strlcat \
#getpwuid \
#geteuid \
#dlopen \
#utime \
#sigsetjmp \
#basename \
#setlocale \
#ftruncate \
#pipe \
#poll \
#getprotobyname \
#getrlimit \
#setrlimit \
#fork

# only build compat strtok if we need to
IF (NOT HAVE_STRTOK_R)
  SET(libCurl_SRCS ${libCurl_SRCS}
    strtok.c
    )
ENDIF (NOT HAVE_STRTOK_R)

# only build compat strtoofft if we need to
IF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
  SET(libCurl_SRCS ${libCurl_SRCS}
    strtoofft.c
    )
ENDIF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)

# The rest of the build

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/..)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

IF(CURL_STATICLIB)
	# Static lib
	SET(CURL_USER_DEFINED_DYNAMIC_OR_STATIC STATIC)
ELSE()
	# DLL / so dynamic lib
	SET(CURL_USER_DEFINED_DYNAMIC_OR_STATIC SHARED)
ENDIF()

ADD_LIBRARY(
	${LIB_NAME}
	${CURL_USER_DEFINED_DYNAMIC_OR_STATIC}
	${libCurl_HEADERS} ${libCurl_SRCS}
)

TARGET_LINK_LIBRARIES(${LIB_NAME} ${CURL_LIBS})

IF(WIN32)
	ADD_DEFINITIONS( -D_USRDLL )
ENDIF()

ADD_DEFINITIONS(
	-DBUILDING_LIBCURL
)

SETUP_CURL_DEPENDENCIES(${LIB_NAME})

# Remove the "lib" prefix since the library is already named "libcurl".
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "")

IF(MSVC)
	IF(NOT BUILD_RELEASE_DEBUG_DIRS)
		# Ugly workaround to remove the "/debug" or "/release" in each output
		SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../")
		SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../")
	ENDIF()
ENDIF()

IF(WIN32)
	IF(NOT CURL_STATICLIB)
		# Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib"
		SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib")
	ENDIF()
ENDIF()