diff options
author | Mark Nunberg <mnunberg@users.noreply.github.com> | 2019-02-21 13:05:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-21 13:05:58 -0500 |
commit | 297de989a647a6f96f25aabea267aa0d18c43328 (patch) | |
tree | 5afda44b01aea8a0b71ab7d01021cc2af9d91dd5 /CMakeLists.txt | |
parent | 4d00404b8fb47e618474d5538e4a720ac1c95d95 (diff) | |
parent | ffceb87ec3aa8504aea933ee4584ff3bc540622f (diff) |
Merge pull request #645 from redis/ssl
SSL Support
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 89ae962..cce2c61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) INCLUDE(GNUInstallDirs) +PROJECT(hiredis) + +OPTION(HIREDIS_SSL "Link against OpenSSL" OFF) MACRO(getVersionBit name) SET(VERSION_REGEX "^#define ${name} (.+)$") @@ -27,7 +30,8 @@ ADD_LIBRARY(hiredis SHARED hiredis.c net.c read.c - sds.c) + sds.c + sslio.c) SET_TARGET_PROPERTIES(hiredis PROPERTIES @@ -44,9 +48,22 @@ INSTALL(FILES hiredis.h read.h sds.h async.h INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/hiredis.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +IF(HIREDIS_SSL) + IF (NOT OPENSSL_ROOT_DIR) + IF (APPLE) + SET(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") + ENDIF() + ENDIF() + FIND_PACKAGE(OpenSSL REQUIRED) + ADD_DEFINITIONS(-DHIREDIS_SSL) + INCLUDE_DIRECTORIES("${OPENSSL_INCLUDE_DIR}") + TARGET_LINK_LIBRARIES(hiredis ${OPENSSL_LIBRARIES}) +ENDIF() + ENABLE_TESTING() -ADD_EXECUTABLE(hiredis-test - test.c) +ADD_EXECUTABLE(hiredis-test test.c) + + TARGET_LINK_LIBRARIES(hiredis-test hiredis) ADD_TEST(NAME hiredis-test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test.sh) |