comparison Resources/CMake/LibCurlConfiguration.cmake @ 29:042ac60f5bf9

simplified build of curl
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 29 Aug 2012 15:27:13 +0200
parents 6ba765ecf3db
children 89383427856a
comparison
equal deleted inserted replaced
28:ef264c1e9ee5 29:042ac60f5bf9
1 if (${STATIC_BUILD}) 1 if (${STATIC_BUILD})
2 SET(CURL_SOURCES_DIR ${CMAKE_BINARY_DIR}/curl-7.26.0) 2 SET(CURL_SOURCES_DIR ${CMAKE_BINARY_DIR}/curl-7.26.0)
3 DownloadPackage("http://curl.haxx.se/download/curl-7.26.0.tar.gz" "${CURL_SOURCES_DIR}" "" "") 3 DownloadPackage("http://curl.haxx.se/download/curl-7.26.0.tar.gz" "${CURL_SOURCES_DIR}" "" "")
4 4
5 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 5 if (0)
6 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 6 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
7 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/WithSsl/x86_64-linux) 7 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
8 elseif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") 8 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/WithSsl/x86_64-linux)
9 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i686-pc-linux-gnu) 9 elseif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
10 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i686-pc-linux-gnu)
11 else()
12 message(FATAL_ERROR "Support your platform here")
13 endif()
14 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
15 if (${MSVC})
16 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/msvc)
17 else()
18 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i586-mingw32msvc)
19 endif()
10 else() 20 else()
11 message(FATAL_ERROR "Support your platform here") 21 message(FATAL_ERROR "Support your platform here")
12 endif() 22 endif()
13 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 23
14 if (${MSVC}) 24 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
15 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/msvc) 25 configure_file("${SOURCE_CONFIG}/curl_config.h" "${CURL_SOURCES_DIR}/lib/curl_config.h" COPYONLY)
16 else() 26 configure_file("${SOURCE_CONFIG}/curlbuild.h" "${CURL_SOURCES_DIR}/include/curl/curlbuild.h" COPYONLY)
17 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i586-mingw32msvc) 27 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
28 configure_file("${SOURCE_CONFIG}/curlbuild.h" "${CURL_SOURCES_DIR}/include/curl/curlbuild.h" COPYONLY)
18 endif() 29 endif()
19 else()
20 message(FATAL_ERROR "Support your platform here")
21 endif()
22
23 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
24 configure_file("${SOURCE_CONFIG}/curl_config.h" "${CURL_SOURCES_DIR}/lib/curl_config.h" COPYONLY)
25 configure_file("${SOURCE_CONFIG}/curlbuild.h" "${CURL_SOURCES_DIR}/include/curl/curlbuild.h" COPYONLY)
26 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
27 configure_file("${SOURCE_CONFIG}/curlbuild.h" "${CURL_SOURCES_DIR}/include/curl/curlbuild.h" COPYONLY)
28 endif() 30 endif()
29 31
30 include_directories(${CURL_SOURCES_DIR}/include) 32 include_directories(${CURL_SOURCES_DIR}/include)
31 33
32 AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib CURL_SOURCES) 34 AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib CURL_SOURCES)
33 source_group(ThirdParty\\LibCurl REGULAR_EXPRESSION ${CURL_SOURCES_DIR}/.*) 35 source_group(ThirdParty\\LibCurl REGULAR_EXPRESSION ${CURL_SOURCES_DIR}/.*)
34 36
35 list(APPEND THIRD_PARTY_SOURCES ${CURL_SOURCES}) 37 #list(APPEND THIRD_PARTY_SOURCES ${CURL_SOURCES})
36 38 add_library(Curl STATIC ${CURL_SOURCES})
39 link_libraries(Curl)
40
37 add_definitions( 41 add_definitions(
38 -DCURL_STATICLIB=1 42 -DCURL_STATICLIB=1
39 -DBUILDING_LIBCURL=1 43 -DBUILDING_LIBCURL=1
40 -DCURL_DISABLE_LDAPS=1 44 -DCURL_DISABLE_LDAPS=1
41 -DCURL_DISABLE_LDAP=1 45 -DCURL_DISABLE_LDAP=1
42 -D_WIN32_WINNT=0x0501 46 -D_WIN32_WINNT=0x0501
47
48 -DCURL_DISABLE_DICT=1
49 -DCURL_DISABLE_FILE=1
50 -DCURL_DISABLE_FTP=1
51 -DCURL_DISABLE_GOPHER=1
52 -DCURL_DISABLE_LDAP=1
53 -DCURL_DISABLE_LDAPS=1
54 -DCURL_DISABLE_POP3=1
55 -DCURL_DISABLE_PROXY=1
56 -DCURL_DISABLE_RTSP=1
57 -DCURL_DISABLE_TELNET=1
58 -DCURL_DISABLE_TFTP=1
43 ) 59 )
44 60
61 if (${ENABLE_SSL})
62 add_definitions(
63 #-DHAVE_LIBSSL=1
64 -DUSE_OPENSSL=1
65 -DUSE_SSLEAY=1
66 )
67 endif()
68
45 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 69 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
70 #set_property(
71 # SOURCE ${CURL_SOURCES}
72 # PROPERTY COMPILE_DEFINITIONS HAVE_CONFIG_H)
73 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
74 SET(TMP_OS "x86_64")
75 else()
76 SET(TMP_OS "x86")
77 endif()
78
46 set_property( 79 set_property(
47 SOURCE ${CURL_SOURCES} 80 SOURCE ${CURL_SOURCES}
48 PROPERTY COMPILE_DEFINITIONS HAVE_CONFIG_H) 81 PROPERTY COMPILE_DEFINITIONS "HAVE_TIME_H;HAVE_STRUCT_TIMEVAL;HAVE_SYS_STAT_H;HAVE_SOCKET;HAVE_STRUCT_SOCKADDR_STORAGE;HAVE_SYS_SOCKET_H;HAVE_SOCKET;HAVE_SYS_SOCKET_H;HAVE_NETINET_IN_H;HAVE_NETDB_H;HAVE_FCNTL_O_NONBLOCK;HAVE_FCNTL_H;HAVE_SELECT;HAVE_ERRNO_H;HAVE_SEND;HAVE_RECV;OS=\"${TMP_OS}\"")
82 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
83 add_definitions(
84 -DRECV_TYPE_ARG1=int
85 -DRECV_TYPE_ARG2=void*
86 -DRECV_TYPE_ARG3=size_t
87 -DRECV_TYPE_ARG4=int
88 -DRECV_TYPE_RETV=ssize_t
89 -DSEND_TYPE_ARG1=int
90 -DSEND_TYPE_ARG2=void*
91 -DSEND_QUAL_ARG2=const
92 -DSEND_TYPE_ARG3=size_t
93 -DSEND_TYPE_ARG4=int
94 -DSEND_TYPE_RETV=ssize_t
95 -DSIZEOF_SHORT=2
96 -DSIZEOF_INT=4
97 -DSIZEOF_SIZE_T=8
98 )
99 elseif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
100 add_definitions(
101 -DRECV_TYPE_ARG1=SOCKET
102 -DRECV_TYPE_ARG2=char*
103 -DRECV_TYPE_ARG3=int
104 -DRECV_TYPE_ARG4=int
105 -DRECV_TYPE_RETV=int
106 -DSEND_TYPE_ARG1=SOCKET
107 -DSEND_TYPE_ARG2=char*
108 -DSEND_QUAL_ARG2=const
109 -DSEND_TYPE_ARG3=int
110 -DSEND_TYPE_ARG4=int
111 -DSEND_TYPE_RETV=int
112 -DSIZEOF_SHORT=2
113 -DSIZEOF_INT=4
114 -DSIZEOF_SIZE_T=4
115 )
116 else()
117 message(FATAL_ERROR "Support your platform here")
118 endif()
49 endif() 119 endif()
50 120
51 else() 121 else()
52 include(FindCURL) 122 include(FindCURL)
53 include_directories(${CURL_INCLUDE_DIRS}) 123 include_directories(${CURL_INCLUDE_DIRS})