2016-12-10 04:45:22 +00:00
|
|
|
# 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.
|
2017-09-19 05:07:59 +00:00
|
|
|
# ROCKSDB_VERSION_STRING
|
|
|
|
# ROCKSDB_VERSION_MAJOR
|
|
|
|
# ROCKSDB_VERSION_MINOR
|
|
|
|
# ROCKSDB_VERSION_PATCH
|
2016-12-10 04:45:22 +00:00
|
|
|
|
|
|
|
find_path(ROCKSDB_INCLUDE_DIR rocksdb/db.h)
|
|
|
|
|
|
|
|
find_library(ROCKSDB_LIBRARIES rocksdb)
|
|
|
|
|
2017-09-19 05:07:59 +00:00
|
|
|
if(ROCKSDB_INCLUDE_DIR AND EXISTS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h")
|
|
|
|
foreach(ver "MAJOR" "MINOR" "PATCH")
|
2018-06-07 11:19:41 +00:00
|
|
|
file(STRINGS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h" ROCKSDB_VER_${ver}_LINE
|
2017-09-19 05:07:59 +00:00
|
|
|
REGEX "^#define[ \t]+ROCKSDB_${ver}[ \t]+[0-9]+$")
|
|
|
|
string(REGEX REPLACE "^#define[ \t]+ROCKSDB_${ver}[ \t]+([0-9]+)$"
|
2018-06-07 11:19:41 +00:00
|
|
|
"\\1" ROCKSDB_VERSION_${ver} "${ROCKSDB_VER_${ver}_LINE}")
|
|
|
|
unset(${ROCKSDB_VER_${ver}_LINE})
|
2017-09-19 05:07:59 +00:00
|
|
|
endforeach()
|
|
|
|
set(ROCKSDB_VERSION_STRING
|
|
|
|
"${ROCKSDB_VERSION_MAJOR}.${ROCKSDB_VERSION_MINOR}.${ROCKSDB_VERSION_PATCH}")
|
|
|
|
endif()
|
|
|
|
|
2016-12-10 04:45:22 +00:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2018-08-06 09:55:02 +00:00
|
|
|
find_package_handle_standard_args(RocksDB
|
2017-09-19 05:07:59 +00:00
|
|
|
REQUIRED_VARS ROCKSDB_LIBRARIES ROCKSDB_INCLUDE_DIR
|
|
|
|
VERSION_VAR ROCKSDB_VERSION_STRING)
|
2016-12-10 04:45:22 +00:00
|
|
|
|
|
|
|
mark_as_advanced(
|
|
|
|
ROCKSDB_INCLUDE_DIR
|
|
|
|
ROCKSDB_LIBRARIES)
|
2018-08-06 09:55:02 +00:00
|
|
|
|
|
|
|
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"
|
2019-03-07 09:04:11 +00:00
|
|
|
IMPORTED_LOCATION "${ROCKSDB_LIBRARIES}"
|
2018-08-06 09:55:02 +00:00
|
|
|
VERSION "${ROCKSDB_VERSION_STRING}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|