summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2018-07-23 13:55:05 +0200
committerKefu Chai <kchai@redhat.com>2018-07-28 19:44:18 +0200
commita61493062c04c2a0891d975187285796480e9131 (patch)
treea41e959dcb4dd57b10d8023a956e9a690ad97eb3 /cmake
parentrocksdb: pickup change to link against libsnappy.a (diff)
downloadceph-a61493062c04c2a0891d975187285796480e9131.tar.xz
ceph-a61493062c04c2a0891d975187285796480e9131.zip
cmake: link against libsnappy.a if WITH_STATIC_LIBSTDCXX
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/BuildRocksDB.cmake5
-rw-r--r--cmake/modules/Findsnappy.cmake12
2 files changed, 15 insertions, 2 deletions
diff --git a/cmake/modules/BuildRocksDB.cmake b/cmake/modules/BuildRocksDB.cmake
index bc0b3d16f62..f3e0c5b2ee1 100644
--- a/cmake/modules/BuildRocksDB.cmake
+++ b/cmake/modules/BuildRocksDB.cmake
@@ -13,7 +13,12 @@ function(do_build_rocksdb)
list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
endif()
+ # libsnappy is a C++ library, we need to force rocksdb to link against
+ # libsnappy statically.
list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_SNAPPY=${SNAPPY_FOUND})
+ if(SNAPPY_FOUND AND WITH_STATIC_LIBSTDCXX)
+ list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_SNAPPY_STATIC_LIB=ON)
+ endif()
list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_LZ4=${LZ4_FOUND})
list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_ZLIB=${ZLIB_FOUND})
list(APPEND ROCKSDB_CMAKE_ARGS -DPORTABLE=ON)
diff --git a/cmake/modules/Findsnappy.cmake b/cmake/modules/Findsnappy.cmake
index 6ed5fda3d57..644eef33bc0 100644
--- a/cmake/modules/Findsnappy.cmake
+++ b/cmake/modules/Findsnappy.cmake
@@ -5,13 +5,21 @@
# SNAPPY_LIBRARIES - List of libraries when using snappy.
# SNAPPY_FOUND - True if snappy found.
+find_package(PkgConfig)
+pkg_search_module(PC_snappy
+ QUIET snappy)
+
find_path(SNAPPY_INCLUDE_DIR
NAMES snappy.h
- HINTS ${SNAPPY_ROOT_DIR}/include)
+ HINTS
+ ${PC_snappy_INCLUDE_DIRS}
+ ${SNAPPY_ROOT_DIR}/include)
find_library(SNAPPY_LIBRARIES
NAMES snappy
- HINTS ${SNAPPY_ROOT_DIR}/lib)
+ HINTS
+ ${PC_snappy_LIBRARY_DIRS}
+ ${SNAPPY_ROOT_DIR}/lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(snappy DEFAULT_MSG SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIR)