From dc6d19b9ece7204609980272e4b158deff224a9a Mon Sep 17 00:00:00 2001 From: m Date: Sun, 31 Mar 2019 18:17:19 +0200 Subject: Port network layer to Winsock With this change, Hiredis builds with MinGW and runs on Windows. --- CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index cce2c61..0616fa6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) +CMAKE_MINIMUM_REQUIRED(VERSION 3.4.0) INCLUDE(GNUInstallDirs) PROJECT(hiredis) @@ -31,11 +31,15 @@ ADD_LIBRARY(hiredis SHARED net.c read.c sds.c + sockcompat.c sslio.c) SET_TARGET_PROPERTIES(hiredis PROPERTIES VERSION "${HIREDIS_SONAME}") +IF(WIN32 OR MINGW) + TARGET_LINK_LIBRARIES(hiredis PRIVATE ws2_32) +ENDIF() CONFIGURE_FILE(hiredis.pc.in hiredis.pc @ONLY) @@ -60,13 +64,13 @@ IF(HIREDIS_SSL) TARGET_LINK_LIBRARIES(hiredis ${OPENSSL_LIBRARIES}) ENDIF() -ENABLE_TESTING() -ADD_EXECUTABLE(hiredis-test test.c) - - -TARGET_LINK_LIBRARIES(hiredis-test hiredis) -ADD_TEST(NAME hiredis-test - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test.sh) +IF(NOT (WIN32 OR MINGW)) + ENABLE_TESTING() + ADD_EXECUTABLE(hiredis-test test.c) + TARGET_LINK_LIBRARIES(hiredis-test hiredis) + ADD_TEST(NAME hiredis-test + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test.sh) +ENDIF() # Add examples IF(ENABLE_EXAMPLES) -- cgit v1.2.3