]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: detect bzip2 and lz4 for rocksdb 7126/head
authorKefu Chai <kchai@redhat.com>
Wed, 6 Jan 2016 11:37:49 +0000 (19:37 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 7 Jan 2016 12:33:06 +0000 (04:33 -0800)
* this change is the cmake port of 911e7a0.
  the rocksdb's Makefile will detect the installed libbz2 and libz4 by
  its own. if the building env happens to have these libraries installed,
  a link time dependency is introduced. so we are forced to link against
  them.
* do not REQUIRE BZip2 in cmake anymore
* only link against bzip2 if it is detected

Signed-off-by: Kefu Chai <kchai@redhat.com>
CMakeLists.txt
src/kv/CMakeLists.txt

index fac55403241243b0578c2f8c6bf6703a40ccb48f..7b267745c66611249682ccfdcb5cab1fa216e904 100644 (file)
@@ -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)
index 3c088991a08327ca53d443a96c5595221d128d78..27773629add892b3d4fcda24c7255a6c0c8cb721 100644 (file)
@@ -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)