Skip to content

Commit

Permalink
Merge pull request #7126 from tchaikov/wip-detect-bzip2-lz4
Browse files Browse the repository at this point in the history
cmake: detect bzip2 and lz4
  • Loading branch information
cbodley committed Jan 9, 2016
2 parents 00040df + 3ded44d commit 0c5e0c2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,8 @@ endif(WITH_REENTRANT_STRSIGNAL)

set(HAVE_LIBROCKSDB 1)

# -lbz2 and -lz link into kv
# -lz link into kv
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)

#option for LTTng
option(WITH_LTTNG "LTTng tracing is enabled" ON)
Expand Down
15 changes: 15 additions & 0 deletions cmake/modules/FindLZ4.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Try to find liblz4
#
# Once done, this will define
#
# LZ4_FOUND
# LZ4_INCLUDE_DIR
# LZ4_LIBRARY

find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
find_library(LZ4_LIBRARY NAMES lz4)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR)

mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)
12 changes: 11 additions & 1 deletion src/kv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,14 @@ add_library(kv_objs OBJECT ${kv_srcs})
add_library(kv STATIC $<TARGET_OBJECTS:kv_objs>)
target_include_directories(kv_objs PUBLIC ${ROCKSDB_INCLUDE_DIR})
target_include_directories(kv PUBLIC ${ROCKSDB_INCLUDE_DIR})
target_link_libraries(kv bz2 z leveldb snappy rocksdb)
target_link_libraries(kv z leveldb snappy rocksdb)

# rocksdb detects bzlib and lz4 in its Makefile, which forces us to do the same.
find_package(BZip2 QUIET)
if (BZIP2_FOUND)
target_link_libraries(kv ${BZIP2_LIBRARIES})
endif (BZIP2_FOUND)
find_package(LZ4 QUIET)
if (LZ4_FOUND)
target_link_libraries(kv ${LZ4_LIBRARY})
endif (LZ4_FOUND)

0 comments on commit 0c5e0c2

Please sign in to comment.