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")
|
|
7 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/x86_64-linux)
|
|
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)
|
8
|
26 set_property(
|
|
27 SOURCE ${CURL_SOURCES}
|
|
28 PROPERTY COMPILE_DEFINITIONS HAVE_CONFIG_H)
|
2
|
29 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
30 configure_file("${SOURCE_CONFIG}/curlbuild.h" "${CURL_SOURCES_DIR}/include/curl/curlbuild.h" COPYONLY)
|
|
31 endif()
|
|
32
|
|
33 include_directories(${CURL_SOURCES_DIR}/include)
|
|
34
|
|
35 AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib CURL_SOURCES)
|
8
|
36 source_group(ThirdParty\\LibCurl REGULAR_EXPRESSION ${CURL_SOURCES_DIR}/.*)
|
2
|
37
|
|
38 list(APPEND THIRD_PARTY_SOURCES ${CURL_SOURCES})
|
|
39
|
|
40 add_definitions(
|
|
41 -DCURL_STATICLIB=1
|
|
42 -DBUILDING_LIBCURL=1
|
8
|
43 -DCURL_DISABLE_LDAPS=1
|
|
44 -DCURL_DISABLE_LDAP=1
|
|
45 -D_WIN32_WINNT=0x0501
|
2
|
46 )
|
|
47
|
|
48 else()
|
|
49 include(FindCURL)
|
|
50 include_directories(${CURL_INCLUDE_DIRS})
|
|
51 link_libraries(${CURL_LIBRARIES})
|
|
52
|
|
53 if (NOT ${CURL_FOUND})
|
|
54 message(FATAL_ERROR "Unable to find LibCurl")
|
|
55 endif()
|
|
56 endif()
|