summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-04-10 15:59:31 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2009-04-10 15:59:31 (GMT)
commit5783d5aab1654ee185036b665b618f7310d9d3f9 (patch)
tree3c2718d7663f1dba5b70f244fcb162f6f7d0b04e /Utilities/cmcurl
parent3c0e239346b24dd77269d5e69c531ca0af187569 (diff)
downloadCMake-5783d5aab1654ee185036b665b618f7310d9d3f9.zip
CMake-5783d5aab1654ee185036b665b618f7310d9d3f9.tar.gz
CMake-5783d5aab1654ee185036b665b618f7310d9d3f9.tar.bz2
ENH: allow for shared build of libcurl and fix build with openssl option (ssl tested on linux and windows
Diffstat (limited to 'Utilities/cmcurl')
-rw-r--r--Utilities/cmcurl/CMakeLists.txt41
1 files changed, 35 insertions, 6 deletions
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index a04b08c..8782458 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -180,11 +180,22 @@ IF(NOT CURL_SPECIAL_LIBZ)
CHECK_LIBRARY_EXISTS_CONCAT("z" inflateEnd HAVE_LIBZ)
ENDIF(NOT CURL_SPECIAL_LIBZ)
-OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON)
+OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code." OFF)
MARK_AS_ADVANCED(CMAKE_USE_OPENSSL)
IF(CMAKE_USE_OPENSSL)
- CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO)
- CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL)
+ SET(USE_SSLEAY TRUE)
+ SET(USE_OPENSSL TRUE)
+ IF(WIN32)
+ FIND_PATH(SSLINCLUDE openssl/crypto.h
+ PATHS c:/hoffman/Tools/openssl_w32vc6-0.9.8g/inc32)
+ INCLUDE_DIRECTORIES(${SSLINCLUDE})
+ FIND_LIBRARY(LIBEAY NAMES libeay32)
+ FIND_LIBRARY(SSLEAY NAMES ssleay32)
+ SET(CURL_LIBS ${CURL_LIBS} ${LIBEAY} ${SSLEAY} )
+ ELSE(WIN32)
+ CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO)
+ CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL)
+ ENDIF(WIN32)
ENDIF(CMAKE_USE_OPENSSL)
# Check for idn
@@ -396,6 +407,11 @@ ENDIF(NOT HAVE_STRNCMPI)
CHECK_SYMBOL_EXISTS(gethostbyaddr "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR)
CHECK_SYMBOL_EXISTS(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY)
CHECK_SYMBOL_EXISTS(inet_addr "${CURL_INCLUDES}" HAVE_INET_ADDR)
+# windows only has this for vista, but will link with it and say
+# that it has it at link time! So, force it off
+IF(WIN32)
+ SET(HAVE_INET_PTON 0 CACHE "" INTERNAL )
+ENDIF(WIN32)
CHECK_SYMBOL_EXISTS(inet_pton "${CURL_INCLUDES}" HAVE_INET_PTON)
CHECK_SYMBOL_EXISTS(inet_ntoa "${CURL_INCLUDES}" HAVE_INET_NTOA)
CHECK_SYMBOL_EXISTS(inet_ntoa_r "${CURL_INCLUDES}" HAVE_INET_NTOA_R)
@@ -701,13 +717,26 @@ INCLUDE(CMake/OtherTests.cmake)
INCLUDE_DIRECTORIES(${LIBCURL_SOURCE_DIR})
INCLUDE_DIRECTORIES(${LIBCURL_BINARY_DIR})
-ADD_DEFINITIONS(-DHAVE_CONFIG_H
- -DCURL_STATICLIB)
+OPTION(CMAKE_BUILD_CURL_SHARED "Should curl be built shared" TRUE)
+IF(CMAKE_BUILD_CURL_SHARED)
+ SET(LIBRARY_TYPE SHARED)
+ ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+ELSE(CMAKE_BUILD_CURL_SHARED)
+ ADD_DEFINITIONS(-DHAVE_CONFIG_H
+ -DCURL_STATICLIB)
+ENDIF(CMAKE_BUILD_CURL_SHARED)
+SET(CURL_STATICLIB)
CONFIGURE_FILE(${LIBCURL_SOURCE_DIR}/config.h.in
${LIBCURL_BINARY_DIR}/config.h)
-ADD_LIBRARY(cmcurl ${libCurl_SRCS})
+
+ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS})
TARGET_LINK_LIBRARIES(cmcurl ${CURL_LIBS})
+IF(CMAKE_BUILD_CURL_SHARED)
+ SET_TARGET_PROPERTIES(cmcurl PROPERTIES DEFINE_SYMBOL BUILDING_LIBCURL
+ RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
+ INSTALL_TARGETS(/bin cmcurl)
+ENDIF(CMAKE_BUILD_CURL_SHARED)
OPTION(CURL_TESTING "Do libCurl testing" OFF)
IF(CURL_TESTING)