diff options
author | Alessio M <masariello@gmail.com> | 2020-09-04 09:31:47 +0100 |
---|---|---|
committer | Alessio M <masariello@gmail.com> | 2020-09-04 09:31:47 +0100 |
commit | d7b1d21e807f8a90a086b2ef5cea9b707d4cc858 (patch) | |
tree | 748b00a48a8b625f1dca22ae4cc5721ab7de87c5 /CMakeLists.txt | |
parent | 07c3618ffe7912c2ebc589ea45501c687a19cf2c (diff) | |
parent | fb0e6c0dd9affd5728c6e0a6423f5dcb7b207947 (diff) |
Merge branch 'master' of github.com:redis/hiredis
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 55c026b..4bdee18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ PROJECT(hiredis) OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF) OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF) +OPTION(ENABLE_SSL_TESTS, "Should we test SSL connections" OFF) MACRO(getVersionBit name) SET(VERSION_REGEX "^#define ${name} (.+)$") @@ -21,6 +22,9 @@ MESSAGE("Detected version: ${VERSION}") PROJECT(hiredis VERSION "${VERSION}") +# Hiredis requires C99 +SET(CMAKE_C_STANDARD 99) + SET(ENABLE_EXAMPLES OFF CACHE BOOL "Enable building hiredis examples") SET(hiredis_sources @@ -92,10 +96,10 @@ INSTALL(FILES hiredis.targets INSTALL(FILES hiredis.h read.h sds.h async.h alloc.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis) - + INSTALL(DIRECTORY adapters DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis) - + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/hiredis.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) @@ -126,7 +130,7 @@ IF(ENABLE_SSL) ENDIF() ENDIF() FIND_PACKAGE(OpenSSL REQUIRED) - SET(hiredis_ssl_sources + SET(hiredis_ssl_sources ssl.c) ADD_LIBRARY(hiredis_ssl SHARED ${hiredis_ssl_sources}) @@ -159,7 +163,7 @@ IF(ENABLE_SSL) INSTALL(FILES hiredis_ssl.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis) - + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/hiredis_ssl.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) @@ -184,7 +188,12 @@ ENDIF() IF(NOT DISABLE_TESTS) ENABLE_TESTING() ADD_EXECUTABLE(hiredis-test test.c) - TARGET_LINK_LIBRARIES(hiredis-test hiredis) + IF(ENABLE_SSL_TESTS) + ADD_DEFINITIONS(-DHIREDIS_TEST_SSL=1) + TARGET_LINK_LIBRARIES(hiredis-test hiredis hiredis_ssl) + ELSE() + TARGET_LINK_LIBRARIES(hiredis-test hiredis) + ENDIF() ADD_TEST(NAME hiredis-test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test.sh) ENDIF() |