curl: Make OpenSSL DLLs available to CMake on Windows

Find the OpenSSL runtime DLLs and place them next to the CMake
executables in the build tree and the install tree.
This commit is contained in:
Bill Hoffman 2012-09-06 15:37:00 -04:00 committed by Brad King
parent c2f47590ef
commit bc0e8c28ec
1 changed files with 24 additions and 2 deletions

View File

@ -182,6 +182,29 @@ IF(CMAKE_USE_OPENSSL)
IF(CURL_CA_BUNDLE) IF(CURL_CA_BUNDLE)
ADD_DEFINITIONS(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}") ADD_DEFINITIONS(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}")
ENDIF(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) ENDIF(CMAKE_USE_OPENSSL)
# Check for idn # Check for idn
@ -690,8 +713,7 @@ ENDFOREACH()
CONFIGURE_FILE(${LIBCURL_SOURCE_DIR}/config.h.in CONFIGURE_FILE(${LIBCURL_SOURCE_DIR}/config.h.in
${LIBCURL_BINARY_DIR}/config.h) ${LIBCURL_BINARY_DIR}/config.h)
ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS} ${CMAKE_CURL_SSL_DLLS})
ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS})
TARGET_LINK_LIBRARIES(cmcurl ${CURL_LIBS}) TARGET_LINK_LIBRARIES(cmcurl ${CURL_LIBS})
IF(CMAKE_BUILD_CURL_SHARED) IF(CMAKE_BUILD_CURL_SHARED)
SET_TARGET_PROPERTIES(cmcurl PROPERTIES DEFINE_SYMBOL BUILDING_LIBCURL SET_TARGET_PROPERTIES(cmcurl PROPERTIES DEFINE_SYMBOL BUILDING_LIBCURL