Link with "ws2_32" library on Windows, if available.

This commit is contained in:
Vincent Richard 2013-02-08 14:24:20 +01:00
parent 173c665e0c
commit 3829cc2f86

View File

@ -19,6 +19,7 @@ INCLUDE(cmake/Utils.cmake)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckTypeSize)
INCLUDE(CheckLibraryExists)
# CMake configuration
@ -568,6 +569,25 @@ CHECK_FUNCTION_EXISTS(localtime_s VMIME_HAVE_LOCALTIME_S)
CHECK_FUNCTION_EXISTS(localtime_r VMIME_HAVE_LOCALTIME_R)
##############################################################################
# Windows-specific checks
IF(WIN32)
# Winsock
CHECK_LIBRARY_EXISTS("ws2_32" getch "${CMAKE_LIBRARY_PATH}" VMIME_HAVE_LIBWS2_32)
IF(VMIME_HAVE_LIBWS2_32)
TARGET_LINK_LIBRARIES(
${VMIME_LIBRARY_NAME}
${TARGET_LINK_LIBRARIES}
"ws2_32"
)
ENDIF()
ENDIF()
##############################################################################
# POSIX-specific checks