Land #219, build Windows DLLs with CMake

This commit is contained in:
Brent Cook 2016-09-04 05:00:31 -05:00
commit 5bb829d86d
4 changed files with 20 additions and 11 deletions

View File

@ -49,7 +49,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "MINGW")
set(BUILD_NC false)
endif()
if(MSVC)
if(WIN32)
set(BUILD_NC false)
endif()
@ -80,14 +80,17 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
add_definitions(-Wno-pointer-sign)
endif()
if(MSVC)
add_definitions(-Dinline=__inline)
if(WIN32)
add_definitions(-Drestrict)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS)
add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS)
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501)
add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT)
endif()
if(MSVC)
add_definitions(-Dinline=__inline)
set(MSVC_DISABLED_WARNINGS_LIST
"C4057" # C4057: 'initializing' : 'unsigned char *' differs in
@ -143,7 +146,7 @@ if(HAVE_STRNDUP)
add_definitions(-DHAVE_STRNDUP)
endif()
if(MSVC)
if(WIN32)
set(HAVE_STRNLEN true)
add_definitions(-DHAVE_STRNLEN)
else()
@ -237,7 +240,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
set(OPENSSL_LIBS ${OPENSSL_LIBS} nsl socket)
endif()
if(NOT (CMAKE_SYSTEM_NAME MATCHES "(Darwin|MINGW|CYGWIN)" OR MSVC))
if(NOT (CMAKE_SYSTEM_NAME MATCHES "(Darwin|CYGWIN)"))
set(BUILD_SHARED true)
endif()

View File

@ -752,10 +752,12 @@ if (BUILD_SHARED)
add_library(crypto-objects OBJECT ${CRYPTO_SRC})
add_library(crypto STATIC $<TARGET_OBJECTS:crypto-objects>)
add_library(crypto-shared SHARED $<TARGET_OBJECTS:crypto-objects>)
if (MSVC)
if (WIN32)
target_link_libraries(crypto-shared crypto Ws2_32.lib)
set(CRYPTO_POSTFIX -${CRYPTO_MAJOR_VERSION})
endif()
set_target_properties(crypto-shared PROPERTIES OUTPUT_NAME crypto)
set_target_properties(crypto-shared PROPERTIES
OUTPUT_NAME crypto${CRYPTO_POSTFIX} ARCHIVE_OUTPUT_NAME crypto)
set_target_properties(crypto-shared PROPERTIES VERSION
${CRYPTO_VERSION} SOVERSION ${CRYPTO_MAJOR_VERSION})
install(TARGETS crypto crypto-shared DESTINATION lib)

View File

@ -52,10 +52,12 @@ if (BUILD_SHARED)
add_library(ssl-objects OBJECT ${SSL_SRC})
add_library(ssl STATIC $<TARGET_OBJECTS:ssl-objects>)
add_library(ssl-shared SHARED $<TARGET_OBJECTS:ssl-objects>)
if (MSVC)
if (WIN32)
target_link_libraries(ssl-shared crypto-shared Ws2_32.lib)
set(SSL_POSTFIX -${SSL_MAJOR_VERSION})
endif()
set_target_properties(ssl-shared PROPERTIES OUTPUT_NAME ssl)
set_target_properties(ssl-shared PROPERTIES
OUTPUT_NAME ssl${SSL_POSTFIX} ARCHIVE_OUTPUT_NAME ssl)
set_target_properties(ssl-shared PROPERTIES VERSION ${SSL_VERSION}
SOVERSION ${SSL_MAJOR_VERSION})
install(TARGETS ssl ssl-shared DESTINATION lib)

View File

@ -31,10 +31,12 @@ if (BUILD_SHARED)
add_library(tls-objects OBJECT ${TLS_SRC})
add_library(tls STATIC $<TARGET_OBJECTS:tls-objects>)
add_library(tls-shared SHARED $<TARGET_OBJECTS:tls-objects>)
if (MSVC)
if (WIN32)
target_link_libraries(tls-shared ssl-shared crypto-shared Ws2_32.lib)
set(TLS_POSTFIX -${TLS_MAJOR_VERSION})
endif()
set_target_properties(tls-shared PROPERTIES OUTPUT_NAME tls)
set_target_properties(tls-shared PROPERTIES
OUTPUT_NAME tls${TLS_POSTFIX} ARCHIVE_OUTPUT_NAME tls)
set_target_properties(tls-shared PROPERTIES VERSION ${TLS_VERSION}
SOVERSION ${TLS_MAJOR_VERSION})
install(TARGETS tls tls-shared DESTINATION lib)