annotate Resources/CMake/LibCurlConfiguration.cmake @ 2:67a6978503b7

fixing Windows build
author Jodogne@Laptop
date Thu, 19 Jul 2012 22:33:27 +0200
parents 3959d33612cc
children 3a584803783e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
1 if (${STATIC_BUILD})
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
2 SET(CURL_SOURCES_DIR ${CMAKE_BINARY_DIR}/curl-7.26.0)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
3 DownloadPackage("http://curl.haxx.se/download/curl-7.26.0.tar.gz" "${CURL_SOURCES_DIR}" "" "")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
4
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
5 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
6 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
7 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/x86_64-linux)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
8 elseif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
9 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i686-pc-linux-gnu)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
10 else()
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
11 message(FATAL_ERROR "Support your platform here")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
12 endif()
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
13 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
14 if (${MSVC})
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
15 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/msvc)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
16 else()
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
17 SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i586-mingw32msvc)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
18 endif()
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
19 else()
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
20 message(FATAL_ERROR "Support your platform here")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
21 endif()
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
22
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
23 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
24 configure_file("${SOURCE_CONFIG}/curl_config.h" "${CURL_SOURCES_DIR}/lib/curl_config.h" COPYONLY)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
25 configure_file("${SOURCE_CONFIG}/curlbuild.h" "${CURL_SOURCES_DIR}/include/curl/curlbuild.h" COPYONLY)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
26 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
27 configure_file("${SOURCE_CONFIG}/curlbuild.h" "${CURL_SOURCES_DIR}/include/curl/curlbuild.h" COPYONLY)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
28 endif()
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
29
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
30 include_directories(${CURL_SOURCES_DIR}/include)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
31
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
32 AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib CURL_SOURCES)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
33
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
34 set_property(
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
35 SOURCE ${CURL_SOURCES}
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
36 PROPERTY COMPILE_DEFINITIONS HAVE_CONFIG_H)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
37
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
38 list(APPEND THIRD_PARTY_SOURCES ${CURL_SOURCES})
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
39
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
40 add_definitions(
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
41 -DCURL_STATICLIB=1
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
42 -DBUILDING_LIBCURL=1
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
43 )
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
44
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
45 #add_library(libcurl STATIC ${CURL_SOURCES})
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
46 #link_libraries(libcurl)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
47
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
48 else()
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
49 include(FindCURL)
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
50 include_directories(${CURL_INCLUDE_DIRS})
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
51 link_libraries(${CURL_LIBRARIES})
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
52
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
53 if (NOT ${CURL_FOUND})
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
54 message(FATAL_ERROR "Unable to find LibCurl")
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
55 endif()
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
56 endif()