diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /cmake/modules/FindRocksDB.cmake | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/FindRocksDB.cmake')
-rw-r--r-- | cmake/modules/FindRocksDB.cmake | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/cmake/modules/FindRocksDB.cmake b/cmake/modules/FindRocksDB.cmake new file mode 100644 index 00000000..c5dd3dfa --- /dev/null +++ b/cmake/modules/FindRocksDB.cmake @@ -0,0 +1,47 @@ +# Find the native Rocksdb includes and library +# This module defines +# ROCKSDB_INCLUDE_DIR, where to find rocksdb/db.h, Set when +# ROCKSDB_INCLUDE_DIR is found. +# ROCKSDB_LIBRARIES, libraries to link against to use Rocksdb. +# ROCKSDB_FOUND, If false, do not try to use Rocksdb. +# ROCKSDB_VERSION_STRING +# ROCKSDB_VERSION_MAJOR +# ROCKSDB_VERSION_MINOR +# ROCKSDB_VERSION_PATCH + +find_path(ROCKSDB_INCLUDE_DIR rocksdb/db.h) + +find_library(ROCKSDB_LIBRARIES rocksdb) + +if(ROCKSDB_INCLUDE_DIR AND EXISTS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h") + foreach(ver "MAJOR" "MINOR" "PATCH") + file(STRINGS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h" ROCKSDB_VER_${ver}_LINE + REGEX "^#define[ \t]+ROCKSDB_${ver}[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+ROCKSDB_${ver}[ \t]+([0-9]+)$" + "\\1" ROCKSDB_VERSION_${ver} "${ROCKSDB_VER_${ver}_LINE}") + unset(${ROCKSDB_VER_${ver}_LINE}) + endforeach() + set(ROCKSDB_VERSION_STRING + "${ROCKSDB_VERSION_MAJOR}.${ROCKSDB_VERSION_MINOR}.${ROCKSDB_VERSION_PATCH}") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(RocksDB + REQUIRED_VARS ROCKSDB_LIBRARIES ROCKSDB_INCLUDE_DIR + VERSION_VAR ROCKSDB_VERSION_STRING) + +mark_as_advanced( + ROCKSDB_INCLUDE_DIR + ROCKSDB_LIBRARIES) + +if(RocksDB_FOUND) + if(NOT TARGET RocksDB::RocksDB) + add_library(RocksDB::RocksDB UNKNOWN IMPORTED) + set_target_properties(RocksDB::RocksDB PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${ROCKSDB_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${ROCKSDB_LIBRARIES}" + VERSION "${ROCKSDB_VERSION_STRING}") + endif() +endif() + |