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)
|
|
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)
|
|
33
|
|
34 set_property(
|
|
35 SOURCE ${CURL_SOURCES}
|
|
36 PROPERTY COMPILE_DEFINITIONS HAVE_CONFIG_H)
|
|
37
|
|
38 list(APPEND THIRD_PARTY_SOURCES ${CURL_SOURCES})
|
|
39
|
|
40 add_definitions(
|
|
41 -DCURL_STATICLIB=1
|
|
42 -DBUILDING_LIBCURL=1
|
|
43 )
|
|
44
|
|
45 #add_library(libcurl STATIC ${CURL_SOURCES})
|
|
46 #link_libraries(libcurl)
|
|
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()
|