
SET(libCurl_SRCS
  #  amigaos.c - does not build on AmigaOS
  base64.c
  connect.c
  content_encoding.c
  cookie.c
  curl_addrinfo.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
  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 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)

INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})

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})

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/config.h)

ADD_LIBRARY(curl ${libCurl_SRCS})
TARGET_LINK_LIBRARIES(curl ${CURL_LIBS})
ADD_DEPENDENCIES(curl z)

