2009-06-10 01:29:16 +08:00
|
|
|
set(LIB_NAME libcurl)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
configure_file(${CURL_SOURCE_DIR}/include/curl/curlbuild.h.cmake
|
2009-04-02 21:14:53 +08:00
|
|
|
${CURL_BINARY_DIR}/include/curl/curlbuild.h)
|
2009-07-14 21:25:14 +08:00
|
|
|
configure_file(curl_config.h.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/curl_config.h)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
|
|
|
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
2009-04-07 06:45:17 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
list(APPEND HHEADERS
|
2009-07-14 21:25:14 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/curl_config.h
|
2009-06-10 01:29:16 +08:00
|
|
|
${CURL_BINARY_DIR}/include/curl/curlbuild.h
|
|
|
|
)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
if(MSVC)
|
|
|
|
list(APPEND CSOURCES libcurl.rc)
|
|
|
|
endif()
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-04-07 06:45:17 +08:00
|
|
|
# SET(CSOURCES
|
2013-01-04 09:50:28 +08:00
|
|
|
# # memdebug.c -not used
|
|
|
|
# # nwlib.c - Not used
|
|
|
|
# # strtok.c - specify later
|
|
|
|
# # strtoofft.c - specify later
|
2009-04-07 06:45:17 +08:00
|
|
|
# )
|
|
|
|
|
|
|
|
# # if we have Kerberos 4, right now this is never on
|
|
|
|
# #OPTION(CURL_KRB4 "Use Kerberos 4" OFF)
|
|
|
|
# IF(CURL_KRB4)
|
2009-06-10 01:29:16 +08:00
|
|
|
# SET(CSOURCES ${CSOURCES}
|
2013-01-04 09:50:28 +08:00
|
|
|
# krb4.c
|
|
|
|
# security.c
|
2009-06-10 01:29:16 +08:00
|
|
|
# )
|
2009-04-07 06:45:17 +08:00
|
|
|
# ENDIF(CURL_KRB4)
|
|
|
|
|
|
|
|
# #OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF)
|
|
|
|
# MARK_AS_ADVANCED(CURL_MALLOC_DEBUG)
|
|
|
|
# IF(CURL_MALLOC_DEBUG)
|
2009-06-10 01:29:16 +08:00
|
|
|
# SET(CSOURCES ${CSOURCES}
|
2013-01-04 09:50:28 +08:00
|
|
|
# memdebug.c
|
2009-06-10 01:29:16 +08:00
|
|
|
# )
|
2009-04-07 06:45:17 +08:00
|
|
|
# ENDIF(CURL_MALLOC_DEBUG)
|
|
|
|
|
|
|
|
# # only build compat strtoofft if we need to
|
|
|
|
# IF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
|
2009-06-10 01:29:16 +08:00
|
|
|
# SET(CSOURCES ${CSOURCES}
|
2013-01-04 09:50:28 +08:00
|
|
|
# strtoofft.c
|
2009-06-10 01:29:16 +08:00
|
|
|
# )
|
2009-04-07 06:45:17 +08:00
|
|
|
# ENDIF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
if(HAVE_FEATURES_H)
|
|
|
|
set_source_files_properties(
|
2013-01-04 09:50:28 +08:00
|
|
|
cookie.c
|
|
|
|
easy.c
|
|
|
|
formdata.c
|
|
|
|
getenv.c
|
|
|
|
nonblock.c
|
|
|
|
hash.c
|
|
|
|
http.c
|
|
|
|
if2ip.c
|
|
|
|
mprintf.c
|
|
|
|
multi.c
|
|
|
|
sendf.c
|
|
|
|
telnet.c
|
|
|
|
transfer.c
|
|
|
|
url.c
|
2009-04-02 21:14:53 +08:00
|
|
|
COMPILE_FLAGS -D_BSD_SOURCE)
|
2009-06-10 01:29:16 +08:00
|
|
|
endif(HAVE_FEATURES_H)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
# The rest of the build
|
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
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})
|
2009-07-15 03:03:31 +08:00
|
|
|
if(CURL_USE_ARES)
|
|
|
|
include_directories(${CARES_INCLUDE_DIR})
|
|
|
|
endif()
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
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()
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
add_library(
|
|
|
|
${LIB_NAME}
|
|
|
|
${CURL_USER_DEFINED_DYNAMIC_OR_STATIC}
|
|
|
|
${HHEADERS} ${CSOURCES}
|
|
|
|
)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
target_link_libraries(${LIB_NAME} ${CURL_LIBS})
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
if(WIN32)
|
|
|
|
add_definitions( -D_USRDLL )
|
|
|
|
endif()
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
set_target_properties(${LIB_NAME} PROPERTIES COMPILE_DEFINITIONS BUILDING_LIBCURL)
|
2009-04-07 04:44:01 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
setup_curl_dependencies(${LIB_NAME})
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-04-07 03:43:52 +08:00
|
|
|
# Remove the "lib" prefix since the library is already named "libcurl".
|
2009-06-10 01:29:16 +08:00
|
|
|
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()
|
2011-04-28 04:05:07 +08:00
|
|
|
|
|
|
|
install(TARGETS ${LIB_NAME} DESTINATION lib)
|