2016-07-14 15:36:14 +00:00
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(incredis CXX)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
include(shared_git_project)
2016-12-02 14:16:32 +00:00
include(CTest)
2016-07-14 15:36:14 +00:00
2017-05-04 21:54:21 +00:00
option(INCREDIS_FORCE_DISABLE_TESTS "Ignore unit tests even if BUILD_TESTING is set to ON - useful if you want to disable incredis tests from your top-level cmake project" OFF)
2016-07-15 18:19:16 +00:00
find_package(hiredis 0.11.0 REQUIRED)
2016-07-14 15:36:14 +00:00
find_package(CryptoPP 5.6)
find_package(libev 4.0 REQUIRED)
find_package(Boost 1.53.0 REQUIRED)
2016-07-14 15:49:09 +00:00
add_shared_git_project("lib/duckhandy")
2016-07-14 15:36:14 +00:00
add_library(${PROJECT_NAME} SHARED
src/command.cpp
src/scan_iterator.cpp
src/reply.cpp
src/batch.cpp
src/script.cpp
src/script_manager.cpp
src/async_connection.cpp
src/incredis.cpp
src/incredis_batch.cpp
2016-12-06 18:39:41 +00:00
src/reply_list.cpp
2016-07-14 15:36:14 +00:00
)
target_include_directories(${PROJECT_NAME} SYSTEM
PUBLIC ${Boost_INCLUDE_DIRS}
PRIVATE ${HIREDIS_INCLUDE_DIRS}
2017-03-31 22:16:14 +00:00
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lib/better-enums
2016-07-14 15:36:14 +00:00
PRIVATE ${LIBEV_INCLUDE_DIRS}
PRIVATE ${Boost_INCLUDE_DIRS}
)
target_include_directories(${PROJECT_NAME}
2016-07-14 15:49:09 +00:00
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
2016-07-14 15:36:14 +00:00
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
2016-07-14 17:13:03 +00:00
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/incredis
2016-07-14 15:36:14 +00:00
)
target_link_libraries(${PROJECT_NAME}
PRIVATE ${HIREDIS_LIBRARIES}
PRIVATE ${LIBEV_LIBRARIES}
PRIVATE ${Boost_LIBRARIES}
2016-07-14 15:49:09 +00:00
PUBLIC duckhandy
2016-07-14 15:36:14 +00:00
)
configure_file(
src/incredisConfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/incredisConfig.h
)
target_compile_definitions(${PROJECT_NAME}
PRIVATE EV_COMPAT3=0
)
if (CryptoPP_FOUND)
target_link_libraries(${PROJECT_NAME} PRIVATE ${CryptoPP_LIBRARIES})
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${CryptoPP_INCLUDE_DIRS})
set (has_cryptopp_lib ON)
else()
set (has_cryptopp_lib OFF)
endif()
2016-12-02 14:16:32 +00:00
set(INCREDIS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
2016-07-14 15:36:14 +00:00
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib/static
)
target_compile_features(${PROJECT_NAME}
PUBLIC cxx_nullptr
PUBLIC cxx_range_for
PUBLIC cxx_lambdas
PUBLIC cxx_decltype_auto
PUBLIC cxx_defaulted_functions
PUBLIC cxx_deleted_functions
PUBLIC cxx_auto_type
PUBLIC cxx_decltype_incomplete_return_types
PUBLIC cxx_defaulted_move_initializers
PUBLIC cxx_noexcept
PUBLIC cxx_rvalue_references
)
2016-12-02 14:16:32 +00:00
2017-05-04 21:54:21 +00:00
if (BUILD_TESTING AND NOT INCREDIS_FORCE_DISABLE_TESTS)
2016-12-02 14:16:32 +00:00
add_subdirectory(test/integration)
endif()