Skip to content

Commit e47313d

Browse files
committed
Allow a static build of redis
1 parent af2993b commit e47313d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

redis/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,12 @@ ENDIF ()
1515

1616
# Compile and link libgit2
1717
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDE_DIRS} ${LIBHIREDIS_INCLUDE_DIRS})
18-
ADD_LIBRARY(git2-redis hiredis.c)
18+
19+
ADD_LIBRARY(core OBJECT hiredis.c)
20+
IF (BUILD_SHARED_LIBS)
21+
ADD_LIBRARY(git2-redis SHARED $<TARGET_OBJECTS:core>)
22+
ELSE ()
23+
ADD_LIBRARY(git2-redis STATIC $<TARGET_OBJECTS:core>)
24+
ENDIF ()
25+
1926
TARGET_LINK_LIBRARIES(git2-redis ${LIBGIT2_LIBRARIES} ${LIBHIREDIS_LIBRARIES})

0 commit comments

Comments
 (0)