Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions redis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
PROJECT(libgit2-redis C)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

INCLUDE(../CMake/FindLibgit2.cmake)
INCLUDE(../CMake/FindHiredis.cmake)

# Build options
OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
OPTION (BUILD_TESTS "Build Tests" ON)
SET (PC_LIBGIT2_LIBRARY_DIRS "" CACHE STRING "libgit2 path")
SET (PC_LIBGIT2_INCLUDE_DIRS "" CACHE STRING "libgit2 include directories")

INCLUDE(../CMake/FindHiredis.cmake)

# Allow overriding to local libgit2. I'm pretty sure I'm doing this wrong.
IF (${PC_LIBGIT2_INCLUDE_DIRS} STREQUAL "")
INCLUDE(../CMake/FindLibgit2.cmake)
ELSE ()
SET (LIBGIT2_LIBRARIES ${PC_LIBGIT2_LIBRARY_DIRS})
SET (LIBGIT2_INCLUDE_DIRS ${PC_LIBGIT2_INCLUDE_DIRS})
ENDIF ()

# Build Release by default
IF (NOT CMAKE_BUILD_TYPE)
Expand All @@ -15,5 +24,12 @@ ENDIF ()

# Compile and link libgit2
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDE_DIRS} ${LIBHIREDIS_INCLUDE_DIRS})
ADD_LIBRARY(git2-redis hiredis.c)

ADD_LIBRARY(core OBJECT hiredis.c)
IF (BUILD_SHARED_LIBS)
ADD_LIBRARY(git2-redis SHARED $<TARGET_OBJECTS:core>)
ELSE ()
ADD_LIBRARY(git2-redis STATIC $<TARGET_OBJECTS:core>)
ENDIF ()

TARGET_LINK_LIBRARIES(git2-redis ${LIBGIT2_LIBRARIES} ${LIBHIREDIS_LIBRARIES})
Loading