0
|
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 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i586-mingw32msvc)
|
|
15 else()
|
|
16 message(FATAL_ERROR "Support your platform here")
|
|
17 endif()
|
|
18
|
|
19 configure_file("${SOURCE_CONFIG}/curl_config.h" "${CURL_SOURCES_DIR}/lib/curl_config.h" COPYONLY)
|
|
20 configure_file("${SOURCE_CONFIG}/curlbuild.h" "${CURL_SOURCES_DIR}/include/curl/curlbuild.h" COPYONLY)
|
|
21
|
|
22 include_directories(${CURL_SOURCES_DIR}/include)
|
|
23
|
|
24 AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib CURL_SOURCES)
|
|
25
|
|
26 set_property(
|
|
27 SOURCE ${CURL_SOURCES}
|
|
28 PROPERTY COMPILE_DEFINITIONS HAVE_CONFIG_H)
|
|
29
|
|
30 list(APPEND THIRD_PARTY_SOURCES ${CURL_SOURCES})
|
|
31
|
|
32 add_definitions(
|
|
33 -DCURL_STATICLIB=1
|
|
34 -DBUILDING_LIBCURL=1
|
|
35 )
|
|
36
|
|
37 #add_library(libcurl STATIC ${CURL_SOURCES})
|
|
38 #link_libraries(libcurl)
|
|
39
|
|
40 else()
|
|
41 include(FindCURL)
|
|
42 include_directories(${CURL_INCLUDE_DIRS})
|
|
43 link_libraries(${CURL_LIBRARIES})
|
|
44
|
|
45 if (NOT ${CURL_FOUND})
|
|
46 message(FATAL_ERROR "Unable to find LibCurl")
|
|
47 endif()
|
|
48 endif()
|