2
|
1 if (${STATIC_BUILD})
|
|
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}" "" "")
|
|
4
|
|
5 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
6 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
26
|
7 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/WithSsl/x86_64-linux)
|
2
|
8 elseif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
|
|
9 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i686-pc-linux-gnu)
|
|
10 else()
|
|
11 message(FATAL_ERROR "Support your platform here")
|
|
12 endif()
|
|
13 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
14 if (${MSVC})
|
|
15 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/msvc)
|
|
16 else()
|
|
17 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i586-mingw32msvc)
|
|
18 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()
|
|
29
|
|
30 include_directories(${CURL_SOURCES_DIR}/include)
|
|
31
|
|
32 AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib CURL_SOURCES)
|
8
|
33 source_group(ThirdParty\\LibCurl REGULAR_EXPRESSION ${CURL_SOURCES_DIR}/.*)
|
2
|
34
|
|
35 list(APPEND THIRD_PARTY_SOURCES ${CURL_SOURCES})
|
|
36
|
|
37 add_definitions(
|
|
38 -DCURL_STATICLIB=1
|
|
39 -DBUILDING_LIBCURL=1
|
8
|
40 -DCURL_DISABLE_LDAPS=1
|
|
41 -DCURL_DISABLE_LDAP=1
|
|
42 -D_WIN32_WINNT=0x0501
|
2
|
43 )
|
|
44
|
15
|
45 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
46 set_property(
|
|
47 SOURCE ${CURL_SOURCES}
|
|
48 PROPERTY COMPILE_DEFINITIONS HAVE_CONFIG_H)
|
|
49 endif()
|
|
50
|
2
|
51 else()
|
|
52 include(FindCURL)
|
|
53 include_directories(${CURL_INCLUDE_DIRS})
|
|
54 link_libraries(${CURL_LIBRARIES})
|
|
55
|
|
56 if (NOT ${CURL_FOUND})
|
|
57 message(FATAL_ERROR "Unable to find LibCurl")
|
|
58 endif()
|
|
59 endif()
|