CMakeLists.txt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. # Copyright 2017 The LevelDB Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file. See the AUTHORS file for names of contributors.
  4. cmake_minimum_required(VERSION 3.9)
  5. # Keep the version below in sync with the one in db.h
  6. project(leveldb VERSION 1.21.0 LANGUAGES C CXX)
  7. # This project can use C11, but will gracefully decay down to C89.
  8. set(CMAKE_C_STANDARD 11)
  9. set(CMAKE_C_STANDARD_REQUIRED OFF)
  10. set(CMAKE_C_EXTENSIONS OFF)
  11. # This project requires C++11.
  12. set(CMAKE_CXX_STANDARD 11)
  13. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  14. set(CMAKE_CXX_EXTENSIONS OFF)
  15. if (WIN32)
  16. set(LEVELDB_PLATFORM_NAME LEVELDB_PLATFORM_WINDOWS)
  17. # TODO(cmumford): Make UNICODE configurable for Windows.
  18. add_definitions(-D_UNICODE -DUNICODE)
  19. else (WIN32)
  20. set(LEVELDB_PLATFORM_NAME LEVELDB_PLATFORM_POSIX)
  21. endif (WIN32)
  22. option(LEVELDB_BUILD_TESTS "Build LevelDB's unit tests" ON)
  23. option(LEVELDB_BUILD_BENCHMARKS "Build LevelDB's benchmarks" ON)
  24. option(LEVELDB_INSTALL "Install LevelDB's header and library" ON)
  25. include(TestBigEndian)
  26. test_big_endian(LEVELDB_IS_BIG_ENDIAN)
  27. include(CheckIncludeFile)
  28. check_include_file("unistd.h" HAVE_UNISTD_H)
  29. include(CheckLibraryExists)
  30. check_library_exists(crc32c crc32c_value "" HAVE_CRC32C)
  31. check_library_exists(snappy snappy_compress "" HAVE_SNAPPY)
  32. check_library_exists(tcmalloc malloc "" HAVE_TCMALLOC)
  33. include(CheckCXXSymbolExists)
  34. # Using check_cxx_symbol_exists() instead of check_c_symbol_exists() because
  35. # we're including the header from C++, and feature detection should use the same
  36. # compiler language that the project will use later. Principles aside, some
  37. # versions of do not expose fdatasync() in <unistd.h> in standard C mode
  38. # (-std=c11), but do expose the function in standard C++ mode (-std=c++11).
  39. check_cxx_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)
  40. check_cxx_symbol_exists(F_FULLFSYNC "fcntl.h" HAVE_FULLFSYNC)
  41. include(CheckCXXSourceCompiles)
  42. # Test whether -Wthread-safety is available. See
  43. # https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
  44. # -Werror is necessary because unknown attributes only generate warnings.
  45. set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
  46. list(APPEND CMAKE_REQUIRED_FLAGS -Werror -Wthread-safety)
  47. check_cxx_source_compiles("
  48. struct __attribute__((lockable)) Lock {
  49. void Acquire() __attribute__((exclusive_lock_function()));
  50. void Release() __attribute__((unlock_function()));
  51. };
  52. struct ThreadSafeType {
  53. Lock lock_;
  54. int data_ __attribute__((guarded_by(lock_)));
  55. };
  56. int main() { return 0; }
  57. " HAVE_CLANG_THREAD_SAFETY)
  58. set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
  59. # Test whether C++17 __has_include is available.
  60. check_cxx_source_compiles("
  61. #if defined(__has_include) && __has_include(<string>)
  62. #include <string>
  63. #endif
  64. int main() { std::string str; return 0; }
  65. " HAVE_CXX17_HAS_INCLUDE)
  66. set(LEVELDB_PUBLIC_INCLUDE_DIR "include/leveldb")
  67. set(LEVELDB_PORT_CONFIG_DIR "include/port")
  68. configure_file(
  69. "${PROJECT_SOURCE_DIR}/port/port_config.h.in"
  70. "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
  71. )
  72. include_directories(
  73. "${PROJECT_BINARY_DIR}/include"
  74. "${PROJECT_SOURCE_DIR}"
  75. )
  76. if(BUILD_SHARED_LIBS)
  77. # Only export LEVELDB_EXPORT symbols from the shared library.
  78. add_compile_options(-fvisibility=hidden)
  79. endif(BUILD_SHARED_LIBS)
  80. add_library(leveldb "")
  81. target_sources(leveldb
  82. PRIVATE
  83. "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
  84. "${PROJECT_SOURCE_DIR}/db/builder.cc"
  85. "${PROJECT_SOURCE_DIR}/db/builder.h"
  86. "${PROJECT_SOURCE_DIR}/db/c.cc"
  87. "${PROJECT_SOURCE_DIR}/db/db_impl.cc"
  88. "${PROJECT_SOURCE_DIR}/db/db_impl.h"
  89. "${PROJECT_SOURCE_DIR}/db/db_iter.cc"
  90. "${PROJECT_SOURCE_DIR}/db/db_iter.h"
  91. "${PROJECT_SOURCE_DIR}/db/dbformat.cc"
  92. "${PROJECT_SOURCE_DIR}/db/dbformat.h"
  93. "${PROJECT_SOURCE_DIR}/db/dumpfile.cc"
  94. "${PROJECT_SOURCE_DIR}/db/filename.cc"
  95. "${PROJECT_SOURCE_DIR}/db/filename.h"
  96. "${PROJECT_SOURCE_DIR}/db/log_format.h"
  97. "${PROJECT_SOURCE_DIR}/db/log_reader.cc"
  98. "${PROJECT_SOURCE_DIR}/db/log_reader.h"
  99. "${PROJECT_SOURCE_DIR}/db/log_writer.cc"
  100. "${PROJECT_SOURCE_DIR}/db/log_writer.h"
  101. "${PROJECT_SOURCE_DIR}/db/memtable.cc"
  102. "${PROJECT_SOURCE_DIR}/db/memtable.h"
  103. "${PROJECT_SOURCE_DIR}/db/repair.cc"
  104. "${PROJECT_SOURCE_DIR}/db/skiplist.h"
  105. "${PROJECT_SOURCE_DIR}/db/snapshot.h"
  106. "${PROJECT_SOURCE_DIR}/db/table_cache.cc"
  107. "${PROJECT_SOURCE_DIR}/db/table_cache.h"
  108. "${PROJECT_SOURCE_DIR}/db/version_edit.cc"
  109. "${PROJECT_SOURCE_DIR}/db/version_edit.h"
  110. "${PROJECT_SOURCE_DIR}/db/version_set.cc"
  111. "${PROJECT_SOURCE_DIR}/db/version_set.h"
  112. "${PROJECT_SOURCE_DIR}/db/write_batch_internal.h"
  113. "${PROJECT_SOURCE_DIR}/db/write_batch.cc"
  114. "${PROJECT_SOURCE_DIR}/port/port_stdcxx.h"
  115. "${PROJECT_SOURCE_DIR}/port/port.h"
  116. "${PROJECT_SOURCE_DIR}/port/thread_annotations.h"
  117. "${PROJECT_SOURCE_DIR}/table/block_builder.cc"
  118. "${PROJECT_SOURCE_DIR}/table/block_builder.h"
  119. "${PROJECT_SOURCE_DIR}/table/block.cc"
  120. "${PROJECT_SOURCE_DIR}/table/block.h"
  121. "${PROJECT_SOURCE_DIR}/table/filter_block.cc"
  122. "${PROJECT_SOURCE_DIR}/table/filter_block.h"
  123. "${PROJECT_SOURCE_DIR}/table/format.cc"
  124. "${PROJECT_SOURCE_DIR}/table/format.h"
  125. "${PROJECT_SOURCE_DIR}/table/iterator_wrapper.h"
  126. "${PROJECT_SOURCE_DIR}/table/iterator.cc"
  127. "${PROJECT_SOURCE_DIR}/table/merger.cc"
  128. "${PROJECT_SOURCE_DIR}/table/merger.h"
  129. "${PROJECT_SOURCE_DIR}/table/table_builder.cc"
  130. "${PROJECT_SOURCE_DIR}/table/table.cc"
  131. "${PROJECT_SOURCE_DIR}/table/two_level_iterator.cc"
  132. "${PROJECT_SOURCE_DIR}/table/two_level_iterator.h"
  133. "${PROJECT_SOURCE_DIR}/util/arena.cc"
  134. "${PROJECT_SOURCE_DIR}/util/arena.h"
  135. "${PROJECT_SOURCE_DIR}/util/bloom.cc"
  136. "${PROJECT_SOURCE_DIR}/util/cache.cc"
  137. "${PROJECT_SOURCE_DIR}/util/coding.cc"
  138. "${PROJECT_SOURCE_DIR}/util/coding.h"
  139. "${PROJECT_SOURCE_DIR}/util/comparator.cc"
  140. "${PROJECT_SOURCE_DIR}/util/crc32c.cc"
  141. "${PROJECT_SOURCE_DIR}/util/crc32c.h"
  142. "${PROJECT_SOURCE_DIR}/util/env.cc"
  143. "${PROJECT_SOURCE_DIR}/util/filter_policy.cc"
  144. "${PROJECT_SOURCE_DIR}/util/hash.cc"
  145. "${PROJECT_SOURCE_DIR}/util/hash.h"
  146. "${PROJECT_SOURCE_DIR}/util/logging.cc"
  147. "${PROJECT_SOURCE_DIR}/util/logging.h"
  148. "${PROJECT_SOURCE_DIR}/util/mutexlock.h"
  149. "${PROJECT_SOURCE_DIR}/util/no_destructor.h"
  150. "${PROJECT_SOURCE_DIR}/util/options.cc"
  151. "${PROJECT_SOURCE_DIR}/util/random.h"
  152. "${PROJECT_SOURCE_DIR}/util/status.cc"
  153. # Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
  154. $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC>
  155. "${LEVELDB_PUBLIC_INCLUDE_DIR}/c.h"
  156. "${LEVELDB_PUBLIC_INCLUDE_DIR}/cache.h"
  157. "${LEVELDB_PUBLIC_INCLUDE_DIR}/comparator.h"
  158. "${LEVELDB_PUBLIC_INCLUDE_DIR}/db.h"
  159. "${LEVELDB_PUBLIC_INCLUDE_DIR}/dumpfile.h"
  160. "${LEVELDB_PUBLIC_INCLUDE_DIR}/env.h"
  161. "${LEVELDB_PUBLIC_INCLUDE_DIR}/export.h"
  162. "${LEVELDB_PUBLIC_INCLUDE_DIR}/filter_policy.h"
  163. "${LEVELDB_PUBLIC_INCLUDE_DIR}/iterator.h"
  164. "${LEVELDB_PUBLIC_INCLUDE_DIR}/options.h"
  165. "${LEVELDB_PUBLIC_INCLUDE_DIR}/slice.h"
  166. "${LEVELDB_PUBLIC_INCLUDE_DIR}/status.h"
  167. "${LEVELDB_PUBLIC_INCLUDE_DIR}/table_builder.h"
  168. "${LEVELDB_PUBLIC_INCLUDE_DIR}/table.h"
  169. "${LEVELDB_PUBLIC_INCLUDE_DIR}/write_batch.h"
  170. )
  171. if (WIN32)
  172. target_sources(leveldb
  173. PRIVATE
  174. "${PROJECT_SOURCE_DIR}/util/env_windows.cc"
  175. "${PROJECT_SOURCE_DIR}/util/windows_logger.h"
  176. )
  177. else (WIN32)
  178. target_sources(leveldb
  179. PRIVATE
  180. "${PROJECT_SOURCE_DIR}/util/env_posix.cc"
  181. "${PROJECT_SOURCE_DIR}/util/posix_logger.h"
  182. )
  183. endif (WIN32)
  184. # MemEnv is not part of the interface and could be pulled to a separate library.
  185. target_sources(leveldb
  186. PRIVATE
  187. "${PROJECT_SOURCE_DIR}/helpers/memenv/memenv.cc"
  188. "${PROJECT_SOURCE_DIR}/helpers/memenv/memenv.h"
  189. )
  190. target_include_directories(leveldb
  191. PUBLIC
  192. $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
  193. $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
  194. )
  195. set_target_properties(leveldb
  196. PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
  197. target_compile_definitions(leveldb
  198. PRIVATE
  199. # Used by include/export.h when building shared libraries.
  200. LEVELDB_COMPILE_LIBRARY
  201. # Used by port/port.h.
  202. ${LEVELDB_PLATFORM_NAME}=1
  203. )
  204. if (NOT HAVE_CXX17_HAS_INCLUDE)
  205. target_compile_definitions(leveldb
  206. PRIVATE
  207. LEVELDB_HAS_PORT_CONFIG_H=1
  208. )
  209. endif(NOT HAVE_CXX17_HAS_INCLUDE)
  210. if(BUILD_SHARED_LIBS)
  211. target_compile_definitions(leveldb
  212. PUBLIC
  213. # Used by include/export.h.
  214. LEVELDB_SHARED_LIBRARY
  215. )
  216. endif(BUILD_SHARED_LIBS)
  217. if(HAVE_CLANG_THREAD_SAFETY)
  218. target_compile_options(leveldb
  219. PUBLIC
  220. -Werror -Wthread-safety)
  221. endif(HAVE_CLANG_THREAD_SAFETY)
  222. if(HAVE_CRC32C)
  223. target_link_libraries(leveldb crc32c)
  224. endif(HAVE_CRC32C)
  225. if(HAVE_SNAPPY)
  226. target_link_libraries(leveldb snappy)
  227. endif(HAVE_SNAPPY)
  228. if(HAVE_TCMALLOC)
  229. target_link_libraries(leveldb tcmalloc)
  230. endif(HAVE_TCMALLOC)
  231. # Needed by port_stdcxx.h
  232. find_package(Threads REQUIRED)
  233. target_link_libraries(leveldb Threads::Threads)
  234. add_executable(leveldbutil
  235. "${PROJECT_SOURCE_DIR}/db/leveldbutil.cc"
  236. )
  237. target_link_libraries(leveldbutil leveldb)
  238. if(LEVELDB_BUILD_TESTS)
  239. enable_testing()
  240. function(leveldb_test test_file)
  241. get_filename_component(test_target_name "${test_file}" NAME_WE)
  242. add_executable("${test_target_name}" "")
  243. target_sources("${test_target_name}"
  244. PRIVATE
  245. "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
  246. "${PROJECT_SOURCE_DIR}/util/testharness.cc"
  247. "${PROJECT_SOURCE_DIR}/util/testharness.h"
  248. "${PROJECT_SOURCE_DIR}/util/testutil.cc"
  249. "${PROJECT_SOURCE_DIR}/util/testutil.h"
  250. "${test_file}"
  251. )
  252. target_link_libraries("${test_target_name}" leveldb)
  253. target_compile_definitions("${test_target_name}"
  254. PRIVATE
  255. ${LEVELDB_PLATFORM_NAME}=1
  256. )
  257. if (NOT HAVE_CXX17_HAS_INCLUDE)
  258. target_compile_definitions("${test_target_name}"
  259. PRIVATE
  260. LEVELDB_HAS_PORT_CONFIG_H=1
  261. )
  262. endif(NOT HAVE_CXX17_HAS_INCLUDE)
  263. add_test(NAME "${test_target_name}" COMMAND "${test_target_name}")
  264. endfunction(leveldb_test)
  265. leveldb_test("${PROJECT_SOURCE_DIR}/db/c_test.c")
  266. leveldb_test("${PROJECT_SOURCE_DIR}/db/fault_injection_test.cc")
  267. leveldb_test("${PROJECT_SOURCE_DIR}/issues/issue178_test.cc")
  268. leveldb_test("${PROJECT_SOURCE_DIR}/issues/issue200_test.cc")
  269. leveldb_test("${PROJECT_SOURCE_DIR}/issues/issue320_test.cc")
  270. leveldb_test("${PROJECT_SOURCE_DIR}/util/env_test.cc")
  271. leveldb_test("${PROJECT_SOURCE_DIR}/util/status_test.cc")
  272. leveldb_test("${PROJECT_SOURCE_DIR}/util/no_destructor_test.cc")
  273. if(NOT BUILD_SHARED_LIBS)
  274. leveldb_test("${PROJECT_SOURCE_DIR}/db/autocompact_test.cc")
  275. leveldb_test("${PROJECT_SOURCE_DIR}/db/corruption_test.cc")
  276. leveldb_test("${PROJECT_SOURCE_DIR}/db/db_test.cc")
  277. leveldb_test("${PROJECT_SOURCE_DIR}/db/dbformat_test.cc")
  278. leveldb_test("${PROJECT_SOURCE_DIR}/db/filename_test.cc")
  279. leveldb_test("${PROJECT_SOURCE_DIR}/db/log_test.cc")
  280. leveldb_test("${PROJECT_SOURCE_DIR}/db/recovery_test.cc")
  281. leveldb_test("${PROJECT_SOURCE_DIR}/db/skiplist_test.cc")
  282. leveldb_test("${PROJECT_SOURCE_DIR}/db/version_edit_test.cc")
  283. leveldb_test("${PROJECT_SOURCE_DIR}/db/version_set_test.cc")
  284. leveldb_test("${PROJECT_SOURCE_DIR}/db/write_batch_test.cc")
  285. leveldb_test("${PROJECT_SOURCE_DIR}/helpers/memenv/memenv_test.cc")
  286. leveldb_test("${PROJECT_SOURCE_DIR}/table/filter_block_test.cc")
  287. leveldb_test("${PROJECT_SOURCE_DIR}/table/table_test.cc")
  288. leveldb_test("${PROJECT_SOURCE_DIR}/util/arena_test.cc")
  289. leveldb_test("${PROJECT_SOURCE_DIR}/util/bloom_test.cc")
  290. leveldb_test("${PROJECT_SOURCE_DIR}/util/cache_test.cc")
  291. leveldb_test("${PROJECT_SOURCE_DIR}/util/coding_test.cc")
  292. leveldb_test("${PROJECT_SOURCE_DIR}/util/crc32c_test.cc")
  293. leveldb_test("${PROJECT_SOURCE_DIR}/util/hash_test.cc")
  294. leveldb_test("${PROJECT_SOURCE_DIR}/util/logging_test.cc")
  295. # TODO(costan): This test also uses
  296. # "${PROJECT_SOURCE_DIR}/util/env_{posix|windows}_test_helper.h"
  297. if (WIN32)
  298. leveldb_test("${PROJECT_SOURCE_DIR}/util/env_windows_test.cc")
  299. else (WIN32)
  300. leveldb_test("${PROJECT_SOURCE_DIR}/util/env_posix_test.cc")
  301. endif (WIN32)
  302. endif(NOT BUILD_SHARED_LIBS)
  303. endif(LEVELDB_BUILD_TESTS)
  304. if(LEVELDB_BUILD_BENCHMARKS)
  305. function(leveldb_benchmark bench_file)
  306. get_filename_component(bench_target_name "${bench_file}" NAME_WE)
  307. add_executable("${bench_target_name}" "")
  308. target_sources("${bench_target_name}"
  309. PRIVATE
  310. "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
  311. "${PROJECT_SOURCE_DIR}/util/histogram.cc"
  312. "${PROJECT_SOURCE_DIR}/util/histogram.h"
  313. "${PROJECT_SOURCE_DIR}/util/testharness.cc"
  314. "${PROJECT_SOURCE_DIR}/util/testharness.h"
  315. "${PROJECT_SOURCE_DIR}/util/testutil.cc"
  316. "${PROJECT_SOURCE_DIR}/util/testutil.h"
  317. "${bench_file}"
  318. )
  319. target_link_libraries("${bench_target_name}" leveldb)
  320. target_compile_definitions("${bench_target_name}"
  321. PRIVATE
  322. ${LEVELDB_PLATFORM_NAME}=1
  323. )
  324. if (NOT HAVE_CXX17_HAS_INCLUDE)
  325. target_compile_definitions("${bench_target_name}"
  326. PRIVATE
  327. LEVELDB_HAS_PORT_CONFIG_H=1
  328. )
  329. endif(NOT HAVE_CXX17_HAS_INCLUDE)
  330. endfunction(leveldb_benchmark)
  331. if(NOT BUILD_SHARED_LIBS)
  332. leveldb_benchmark("${PROJECT_SOURCE_DIR}/db/db_bench.cc")
  333. endif(NOT BUILD_SHARED_LIBS)
  334. check_library_exists(sqlite3 sqlite3_open "" HAVE_SQLITE3)
  335. if(HAVE_SQLITE3)
  336. leveldb_benchmark("${PROJECT_SOURCE_DIR}/doc/bench/db_bench_sqlite3.cc")
  337. target_link_libraries(db_bench_sqlite3 sqlite3)
  338. endif(HAVE_SQLITE3)
  339. # check_library_exists is insufficient here because the library names have
  340. # different manglings when compiled with clang or gcc, at least when installed
  341. # with Homebrew on Mac.
  342. set(OLD_CMAKE_REQURED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
  343. list(APPEND CMAKE_REQUIRED_LIBRARIES kyotocabinet)
  344. check_cxx_source_compiles("
  345. #include <kcpolydb.h>
  346. int main() {
  347. kyotocabinet::TreeDB* db = new kyotocabinet::TreeDB();
  348. delete db;
  349. return 0;
  350. }
  351. " HAVE_KYOTOCABINET)
  352. set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQURED_LIBRARIES})
  353. if(HAVE_KYOTOCABINET)
  354. leveldb_benchmark("${PROJECT_SOURCE_DIR}/doc/bench/db_bench_tree_db.cc")
  355. target_link_libraries(db_bench_tree_db kyotocabinet)
  356. endif(HAVE_KYOTOCABINET)
  357. endif(LEVELDB_BUILD_BENCHMARKS)
  358. if(LEVELDB_INSTALL)
  359. include(GNUInstallDirs)
  360. install(TARGETS leveldb
  361. EXPORT leveldbTargets
  362. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  363. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  364. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  365. )
  366. install(
  367. FILES
  368. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/c.h"
  369. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/cache.h"
  370. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/comparator.h"
  371. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/db.h"
  372. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/dumpfile.h"
  373. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/env.h"
  374. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/export.h"
  375. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/filter_policy.h"
  376. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/iterator.h"
  377. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/options.h"
  378. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/slice.h"
  379. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/status.h"
  380. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/table_builder.h"
  381. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/table.h"
  382. "${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/write_batch.h"
  383. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/leveldb
  384. )
  385. include(CMakePackageConfigHelpers)
  386. write_basic_package_version_file(
  387. "${PROJECT_BINARY_DIR}/leveldbConfigVersion.cmake"
  388. COMPATIBILITY SameMajorVersion
  389. )
  390. install(
  391. EXPORT leveldbTargets
  392. NAMESPACE leveldb::
  393. DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
  394. )
  395. install(
  396. FILES
  397. "${PROJECT_SOURCE_DIR}/cmake/leveldbConfig.cmake"
  398. "${PROJECT_BINARY_DIR}/leveldbConfigVersion.cmake"
  399. DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
  400. )
  401. endif(LEVELDB_INSTALL)