diff options
author | Mark Nunberg <mnunberg@users.noreply.github.com> | 2019-04-02 01:17:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-02 01:17:11 -0400 |
commit | ca153fa4a8ae84021bdce7ec47e5339eef1d9212 (patch) | |
tree | 3d963d9e7fddb9db41da1469b989471b2c54ac07 /CMakeLists.txt | |
parent | 1c43a3823f7cd11e8d25d1979ba5eb01720f0b77 (diff) | |
parent | e38cd75562ddb3a20e5dff8969c96568a4fb1ea1 (diff) |
Merge pull request #652 from mbitsnbites/mingw-support
Add MinGW support
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cce2c61..c8c8071 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) @@ -22,8 +22,6 @@ PROJECT(hiredis VERSION "${VERSION}") SET(ENABLE_EXAMPLES OFF CACHE BOOL "Enable building hiredis examples") -INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}) - ADD_LIBRARY(hiredis SHARED async.c dict.c @@ -31,11 +29,16 @@ 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() +TARGET_INCLUDE_DIRECTORIES(hiredis PUBLIC .) CONFIGURE_FILE(hiredis.pc.in hiredis.pc @ONLY) @@ -55,18 +58,18 @@ IF(HIREDIS_SSL) ENDIF() ENDIF() FIND_PACKAGE(OpenSSL REQUIRED) - ADD_DEFINITIONS(-DHIREDIS_SSL) - INCLUDE_DIRECTORIES("${OPENSSL_INCLUDE_DIR}") - TARGET_LINK_LIBRARIES(hiredis ${OPENSSL_LIBRARIES}) + TARGET_COMPILE_DEFINITIONS(hiredis PRIVATE HIREDIS_SSL) + TARGET_INCLUDE_DIRECTORIES(hiredis PRIVATE "${OPENSSL_INCLUDE_DIR}") + TARGET_LINK_LIBRARIES(hiredis PRIVATE ${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) |