build MinGW on CMake

This commit is contained in:
Satoshi Yasushima 2016-08-25 18:17:12 +09:00
parent 8edd509e2c
commit 971892766d
4 changed files with 10 additions and 7 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()

View File

@ -752,7 +752,7 @@ 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)
endif()
set_target_properties(crypto-shared PROPERTIES OUTPUT_NAME crypto)

View File

@ -52,7 +52,7 @@ 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)
endif()
set_target_properties(ssl-shared PROPERTIES OUTPUT_NAME ssl)

View File

@ -31,7 +31,7 @@ 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)
endif()
set_target_properties(tls-shared PROPERTIES OUTPUT_NAME tls)