diff Resources/CMake/LibCurlConfiguration.cmake @ 0:3959d33612cc

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Jul 2012 14:32:22 +0200
parents
children 67a6978503b7
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CMake/LibCurlConfiguration.cmake	Thu Jul 19 14:32:22 2012 +0200
@@ -0,0 +1,48 @@
+if (${STATIC_BUILD})
+  SET(CURL_SOURCES_DIR ${CMAKE_BINARY_DIR}/curl-7.26.0)
+  DownloadPackage("http://curl.haxx.se/download/curl-7.26.0.tar.gz" "${CURL_SOURCES_DIR}" "" "")
+
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+    if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+      SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/x86_64-linux)
+    elseif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
+      SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i686-pc-linux-gnu)
+    else()
+      message(FATAL_ERROR "Support your platform here")
+    endif()
+  elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+    SET(SOURCE_CONFIG ${CMAKE_SOURCE_DIR}/Resources/libcurl/i586-mingw32msvc)
+  else()
+    message(FATAL_ERROR "Support your platform here")
+  endif()
+
+  configure_file("${SOURCE_CONFIG}/curl_config.h" "${CURL_SOURCES_DIR}/lib/curl_config.h" COPYONLY)
+  configure_file("${SOURCE_CONFIG}/curlbuild.h" "${CURL_SOURCES_DIR}/include/curl/curlbuild.h" COPYONLY)
+
+  include_directories(${CURL_SOURCES_DIR}/include)
+
+  AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib CURL_SOURCES)
+
+  set_property(
+    SOURCE ${CURL_SOURCES}
+    PROPERTY COMPILE_DEFINITIONS HAVE_CONFIG_H)
+
+  list(APPEND THIRD_PARTY_SOURCES ${CURL_SOURCES})
+  
+  add_definitions(
+    -DCURL_STATICLIB=1
+    -DBUILDING_LIBCURL=1
+    )
+
+  #add_library(libcurl STATIC ${CURL_SOURCES})
+  #link_libraries(libcurl)
+
+else()
+  include(FindCURL)
+  include_directories(${CURL_INCLUDE_DIRS})
+  link_libraries(${CURL_LIBRARIES})
+
+  if (NOT ${CURL_FOUND})
+    message(FATAL_ERROR "Unable to find LibCurl")
+  endif()
+endif()