annotate Resources/CMake/LibCurlConfiguration.cmake @ 2013:f6e68c0c2737

fix for msvc
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 13 Jun 2016 10:26:56 +0200
parents 307b9ea6c39b
children fefbe71c2272
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
1 if (STATIC_BUILD OR NOT USE_SYSTEM_CURL)
1527
7b58e0048874 Upgrade to curl 7.44.0 for static and Windows builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
2 SET(CURL_SOURCES_DIR ${CMAKE_BINARY_DIR}/curl-7.44.0)
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1536
diff changeset
3 SET(CURL_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/curl-7.44.0.tar.gz")
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1536
diff changeset
4 SET(CURL_MD5 "cf46112b5151e2f1a3fd38439bdade23")
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1536
diff changeset
5
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1536
diff changeset
6 DownloadPackage(${CURL_MD5} ${CURL_URL} "${CURL_SOURCES_DIR}")
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
7
1527
7b58e0048874 Upgrade to curl 7.44.0 for static and Windows builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
8 include_directories(
7b58e0048874 Upgrade to curl 7.44.0 for static and Windows builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
9 ${CURL_SOURCES_DIR}/include
7b58e0048874 Upgrade to curl 7.44.0 for static and Windows builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
10 )
7b58e0048874 Upgrade to curl 7.44.0 for static and Windows builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
11
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
12 AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib CURL_SOURCES)
1527
7b58e0048874 Upgrade to curl 7.44.0 for static and Windows builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
13 AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib/vtls CURL_SOURCES)
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
14 source_group(ThirdParty\\LibCurl REGULAR_EXPRESSION ${CURL_SOURCES_DIR}/.*)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
15
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
16 add_definitions(
1536
1b03676d68c2 fix windows build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1533
diff changeset
17 -DBUILDING_LIBCURL=1
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
18 -DCURL_STATICLIB=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
19 -DCURL_DISABLE_LDAPS=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
20 -DCURL_DISABLE_LDAP=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
21 -DCURL_DISABLE_DICT=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
22 -DCURL_DISABLE_FILE=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
23 -DCURL_DISABLE_FTP=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
24 -DCURL_DISABLE_GOPHER=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
25 -DCURL_DISABLE_LDAP=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
26 -DCURL_DISABLE_LDAPS=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
27 -DCURL_DISABLE_POP3=1
1273
88010d8e12cf Support of HTTP proxy
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 930
diff changeset
28 #-DCURL_DISABLE_PROXY=1
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
29 -DCURL_DISABLE_RTSP=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
30 -DCURL_DISABLE_TELNET=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
31 -DCURL_DISABLE_TFTP=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
32 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
33
1415
728c22ade2e2 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1337
diff changeset
34 if (ENABLE_SSL)
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
35 add_definitions(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
36 #-DHAVE_LIBSSL=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
37 -DUSE_OPENSSL=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
38 -DUSE_SSLEAY=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
39 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
40 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
41
1533
0011cc99443c improving HTTPS support
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1532
diff changeset
42 file(WRITE ${CURL_SOURCES_DIR}/lib/curl_config.h "")
0011cc99443c improving HTTPS support
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1532
diff changeset
43
1536
1b03676d68c2 fix windows build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1533
diff changeset
44 file(GLOB CURL_LIBS_HEADERS ${CURL_SOURCES_DIR}/lib/*.h)
1b03676d68c2 fix windows build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1533
diff changeset
45 foreach (header IN LISTS CURL_LIBS_HEADERS)
1b03676d68c2 fix windows build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1533
diff changeset
46 get_filename_component(filename ${header} NAME)
1b03676d68c2 fix windows build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1533
diff changeset
47 file(WRITE ${CURL_SOURCES_DIR}/lib/vtls/${filename} "#include \"../${filename}\"\n")
1b03676d68c2 fix windows build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1533
diff changeset
48 endforeach()
1b03676d68c2 fix windows build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1533
diff changeset
49
1544
4d0e2c38d15b fix msvc build
jodogne
parents: 1537
diff changeset
50 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
930
27d256e0b458 integration mainline -> mac
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 928 890
diff changeset
51 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
1337
afaa55d42ddd FreeBSD support
jodogne
parents: 1273
diff changeset
52 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
890
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 735
diff changeset
53 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
54 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
55 SET(TMP_OS "x86_64")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
56 else()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
57 SET(TMP_OS "x86")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
58 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
59
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
60 set_property(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
61 SOURCE ${CURL_SOURCES}
1531
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1530
diff changeset
62 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;HAVE_LONGLONG;OS=\"${TMP_OS}\""
1527
7b58e0048874 Upgrade to curl 7.44.0 for static and Windows builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
63 )
7b58e0048874 Upgrade to curl 7.44.0 for static and Windows builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
64
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
65 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
66 add_definitions(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
67 -DRECV_TYPE_ARG1=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
68 -DRECV_TYPE_ARG2=void*
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
69 -DRECV_TYPE_ARG3=size_t
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
70 -DRECV_TYPE_ARG4=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
71 -DRECV_TYPE_RETV=ssize_t
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
72 -DSEND_TYPE_ARG1=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
73 -DSEND_TYPE_ARG2=void*
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
74 -DSEND_QUAL_ARG2=const
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
75 -DSEND_TYPE_ARG3=size_t
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
76 -DSEND_TYPE_ARG4=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
77 -DSEND_TYPE_RETV=ssize_t
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
78 -DSIZEOF_SHORT=2
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
79 -DSIZEOF_INT=4
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
80 -DSIZEOF_SIZE_T=8
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
81 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
82 elseif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
83 add_definitions(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
84 -DRECV_TYPE_ARG1=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
85 -DRECV_TYPE_ARG2=void*
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
86 -DRECV_TYPE_ARG3=size_t
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
87 -DRECV_TYPE_ARG4=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
88 -DRECV_TYPE_RETV=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
89 -DSEND_TYPE_ARG1=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
90 -DSEND_TYPE_ARG2=void*
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
91 -DSEND_QUAL_ARG2=const
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
92 -DSEND_TYPE_ARG3=size_t
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
93 -DSEND_TYPE_ARG4=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
94 -DSEND_TYPE_RETV=int
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
95 -DSIZEOF_SHORT=2
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
96 -DSIZEOF_INT=4
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
97 -DSIZEOF_SIZE_T=4
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
98 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
99 else()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
100 message(FATAL_ERROR "Support your platform here")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
101 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
102 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
103
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
104 else()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
105 include(FindCURL)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
106 include_directories(${CURL_INCLUDE_DIRS})
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
107 link_libraries(${CURL_LIBRARIES})
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
108
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
109 if (NOT ${CURL_FOUND})
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
110 message(FATAL_ERROR "Unable to find LibCurl")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
111 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
112 endif()