Merge topic 'curl-openssl'

8b51762 curl: Honor OPENSSL_NO_SSL2
bc0e8c2 curl: Make OpenSSL DLLs available to CMake on Windows
c2f4759 curl: Use find_package(OpenSSL)
This commit is contained in:
Brad King 2012-09-11 15:01:57 -04:00 committed by CMake Topic Stage
commit 1d3db6b34d
5 changed files with 38 additions and 19 deletions

View File

@ -169,27 +169,42 @@ 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." OFF)
OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code with curl." OFF)
MARK_AS_ADVANCED(CMAKE_USE_OPENSSL)
IF(CMAKE_USE_OPENSSL)
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)
FIND_PACKAGE(OpenSSL REQUIRED)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBS ${CURL_LIBS} ${OPENSSL_LIBRARIES})
SET(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle")
MARK_AS_ADVANCED(CURL_CA_BUNDLE)
IF(CURL_CA_BUNDLE)
ADD_DEFINITIONS(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}")
ENDIF(CURL_CA_BUNDLE)
# for windows we want to install OPENSSL_LIBRARIES dlls
# and also copy them into the build tree so that testing
# can find them.
IF(WIN32)
FIND_FILE(CMAKE_EAY_DLL NAME libeay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..)
FIND_FILE(CMAKE_SSL_DLL NAME ssleay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..)
MARK_AS_ADVANCED(CMAKE_EAY_DLL CMAKE_SSL_DLL)
IF(CMAKE_SSL_DLL AND CMAKE_EAY_DLL)
SET(CMAKE_CURL_SSL_DLLS ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll
${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll)
ADD_CUSTOM_COMMAND(OUTPUT
${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll
DEPENDS ${CMAKE_EAY_DLL}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_EAY_DLL}
${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll)
ADD_CUSTOM_COMMAND(OUTPUT
${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll
DEPENDS ${CMAKE_SSL_DLL}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SSL_DLL}
${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll)
INSTALL(PROGRAMS ${CMAKE_EAY_DLL} ${CMAKE_SSL_DLL} DESTINATION bin)
ENDIF()
ENDIF()
ENDIF(CMAKE_USE_OPENSSL)
# Check for idn
@ -698,8 +713,7 @@ ENDFOREACH()
CONFIGURE_FILE(${LIBCURL_SOURCE_DIR}/config.h.in
${LIBCURL_BINARY_DIR}/config.h)
ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS})
ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS} ${CMAKE_CURL_SSL_DLLS})
TARGET_LINK_LIBRARIES(cmcurl ${CURL_LIBS})
IF(CMAKE_BUILD_CURL_SHARED)
SET_TARGET_PROPERTIES(cmcurl PROPERTIES DEFINE_SYMBOL BUILDING_LIBCURL

View File

@ -255,9 +255,6 @@
/* Define to 1 if you have the <libssh2.h> header file. */
#cmakedefine HAVE_LIBSSH2_H ${HAVE_LIBSSH2_H}
/* Define to 1 if you have the `ssl' library (-lssl). */
#cmakedefine HAVE_LIBSSL ${HAVE_LIBSSL}
/* if zlib is available */
#cmakedefine HAVE_LIBZ ${HAVE_LIBZ}

View File

@ -312,7 +312,7 @@ typedef enum {
CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
CURLE_FAILED_INIT, /* 2 */
CURLE_URL_MALFORMAT, /* 3 */
CURLE_URL_MALFORMAT_USER, /* 4 - NOT USED */
CURLE_NOT_BUILT_IN, /* 4 */
CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
CURLE_COULDNT_RESOLVE_HOST, /* 6 */
CURLE_COULDNT_CONNECT, /* 7 */

View File

@ -1285,8 +1285,13 @@ Curl_ossl_connect_step1(struct connectdata *conn,
req_method = TLSv1_client_method();
break;
case CURL_SSLVERSION_SSLv2:
#ifdef OPENSSL_NO_SSL2
failf(data, "OpenSSL was built without SSLv2 support");
return CURLE_NOT_BUILT_IN;
#else
req_method = SSLv2_client_method();
break;
#endif
case CURL_SSLVERSION_SSLv3:
req_method = SSLv3_client_method();
break;

View File

@ -69,6 +69,10 @@ curl_easy_strerror(CURLcode error)
case CURLE_URL_MALFORMAT:
return "URL using bad/illegal format or missing URL";
case CURLE_NOT_BUILT_IN:
return "A requested feature, protocol or option was not found built-in in"
" this libcurl due to a build-time decision.";
case CURLE_COULDNT_RESOLVE_PROXY:
return "couldn't resolve proxy name";
@ -287,7 +291,6 @@ curl_easy_strerror(CURLcode error)
return "Error in the SSH layer";
/* error codes not used by current libcurl */
case CURLE_URL_MALFORMAT_USER:
case CURLE_FTP_USER_PASSWORD_INCORRECT:
case CURLE_MALFORMAT_USER:
case CURLE_BAD_CALLING_ORDER: