25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

530 satır
16 KiB

2 hafta önce
  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.23.0 LANGUAGES C CXX)
  7. # C standard can be overridden when this is used as a sub-project.
  8. if(NOT CMAKE_C_STANDARD)
  9. # This project can use C11, but will gracefully decay down to C89.
  10. set(CMAKE_C_STANDARD 11)
  11. set(CMAKE_C_STANDARD_REQUIRED OFF)
  12. set(CMAKE_C_EXTENSIONS OFF)
  13. endif(NOT CMAKE_C_STANDARD)
  14. # C++ standard can be overridden when this is used as a sub-project.
  15. if(NOT CMAKE_CXX_STANDARD)
  16. # This project requires C++11.
  17. set(CMAKE_CXX_STANDARD 11)
  18. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  19. set(CMAKE_CXX_EXTENSIONS OFF)
  20. endif(NOT CMAKE_CXX_STANDARD)
  21. if (WIN32)
  22. set(LEVELDB_PLATFORM_NAME LEVELDB_PLATFORM_WINDOWS)
  23. # TODO(cmumford): Make UNICODE configurable for Windows.
  24. add_definitions(-D_UNICODE -DUNICODE)
  25. else (WIN32)
  26. set(LEVELDB_PLATFORM_NAME LEVELDB_PLATFORM_POSIX)
  27. endif (WIN32)
  28. option(LEVELDB_BUILD_TESTS "Build LevelDB's unit tests" ON)
  29. option(LEVELDB_BUILD_BENCHMARKS "Build LevelDB's benchmarks" ON)
  30. option(LEVELDB_INSTALL "Install LevelDB's header and library" ON)
  31. include(CheckIncludeFile)
  32. check_include_file("unistd.h" HAVE_UNISTD_H)
  33. include(CheckLibraryExists)
  34. check_library_exists(crc32c crc32c_value "" HAVE_CRC32C)
  35. check_library_exists(snappy snappy_compress "" HAVE_SNAPPY)
  36. check_library_exists(zstd zstd_compress "" HAVE_ZSTD)
  37. check_library_exists(tcmalloc malloc "" HAVE_TCMALLOC)
  38. include(CheckCXXSymbolExists)
  39. # Using check_cxx_symbol_exists() instead of check_c_symbol_exists() because
  40. # we're including the header from C++, and feature detection should use the same
  41. # compiler language that the project will use later. Principles aside, some
  42. # versions of do not expose fdatasync() in <unistd.h> in standard C mode
  43. # (-std=c11), but do expose the function in standard C++ mode (-std=c++11).
  44. check_cxx_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)
  45. check_cxx_symbol_exists(F_FULLFSYNC "fcntl.h" HAVE_FULLFSYNC)
  46. check_cxx_symbol_exists(O_CLOEXEC "fcntl.h" HAVE_O_CLOEXEC)
  47. if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
  48. # Disable C++ exceptions.
  49. string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  50. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs-c-")
  51. add_definitions(-D_HAS_EXCEPTIONS=0)
  52. # Disable RTTI.
  53. string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  54. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
  55. else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
  56. # Enable strict prototype warnings for C code in clang and gcc.
  57. if(NOT CMAKE_C_FLAGS MATCHES "-Wstrict-prototypes")
  58. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes")
  59. endif(NOT CMAKE_C_FLAGS MATCHES "-Wstrict-prototypes")
  60. # Disable C++ exceptions.
  61. string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  62. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
  63. # Disable RTTI.
  64. string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  65. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
  66. endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
  67. # Test whether -Wthread-safety is available. See
  68. # https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
  69. include(CheckCXXCompilerFlag)
  70. check_cxx_compiler_flag(-Wthread-safety HAVE_CLANG_THREAD_SAFETY)
  71. # Used by googletest.
  72. check_cxx_compiler_flag(-Wno-missing-field-initializers
  73. LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS)
  74. include(CheckCXXSourceCompiles)
  75. # Test whether C++17 __has_include is available.
  76. check_cxx_source_compiles("
  77. #if defined(__has_include) && __has_include(<string>)
  78. #include <string>
  79. #endif
  80. int main() { std::string str; return 0; }
  81. " HAVE_CXX17_HAS_INCLUDE)
  82. set(LEVELDB_PUBLIC_INCLUDE_DIR "include/leveldb")
  83. set(LEVELDB_PORT_CONFIG_DIR "include/port")
  84. configure_file(
  85. "port/port_config.h.in"
  86. "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
  87. )
  88. include_directories(
  89. "${PROJECT_BINARY_DIR}/include"
  90. "."
  91. )
  92. if(BUILD_SHARED_LIBS)
  93. # Only export LEVELDB_EXPORT symbols from the shared library.
  94. add_compile_options(-fvisibility=hidden)
  95. endif(BUILD_SHARED_LIBS)
  96. # Must be included before CMAKE_INSTALL_INCLUDEDIR is used.
  97. include(GNUInstallDirs)
  98. add_library(leveldb "")
  99. target_sources(leveldb
  100. PRIVATE
  101. "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
  102. "db/builder.cc"
  103. "db/builder.h"
  104. "db/c.cc"
  105. "db/db_impl.cc"
  106. "db/db_impl.h"
  107. "db/db_iter.cc"
  108. "db/db_iter.h"
  109. "db/dbformat.cc"
  110. "db/dbformat.h"
  111. "db/dumpfile.cc"
  112. "db/filename.cc"
  113. "db/filename.h"
  114. "db/log_format.h"
  115. "db/log_reader.cc"
  116. "db/log_reader.h"
  117. "db/log_writer.cc"
  118. "db/log_writer.h"
  119. "db/memtable.cc"
  120. "db/memtable.h"
  121. "db/repair.cc"
  122. "db/skiplist.h"
  123. "db/snapshot.h"
  124. "db/table_cache.cc"
  125. "db/table_cache.h"
  126. "db/version_edit.cc"
  127. "db/version_edit.h"
  128. "db/version_set.cc"
  129. "db/version_set.h"
  130. "db/write_batch_internal.h"
  131. "db/write_batch.cc"
  132. "port/port_stdcxx.h"
  133. "port/port.h"
  134. "port/thread_annotations.h"
  135. "table/block_builder.cc"
  136. "table/block_builder.h"
  137. "table/block.cc"
  138. "table/block.h"
  139. "table/filter_block.cc"
  140. "table/filter_block.h"
  141. "table/format.cc"
  142. "table/format.h"
  143. "table/iterator_wrapper.h"
  144. "table/iterator.cc"
  145. "table/merger.cc"
  146. "table/merger.h"
  147. "table/table_builder.cc"
  148. "table/table.cc"
  149. "table/two_level_iterator.cc"
  150. "table/two_level_iterator.h"
  151. "util/arena.cc"
  152. "util/arena.h"
  153. "util/bloom.cc"
  154. "util/cache.cc"
  155. "util/coding.cc"
  156. "util/coding.h"
  157. "util/comparator.cc"
  158. "util/crc32c.cc"
  159. "util/crc32c.h"
  160. "util/env.cc"
  161. "util/filter_policy.cc"
  162. "util/hash.cc"
  163. "util/hash.h"
  164. "util/logging.cc"
  165. "util/logging.h"
  166. "util/mutexlock.h"
  167. "util/no_destructor.h"
  168. "util/options.cc"
  169. "util/random.h"
  170. "util/status.cc"
  171. # Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
  172. $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC>
  173. "${LEVELDB_PUBLIC_INCLUDE_DIR}/c.h"
  174. "${LEVELDB_PUBLIC_INCLUDE_DIR}/cache.h"
  175. "${LEVELDB_PUBLIC_INCLUDE_DIR}/comparator.h"
  176. "${LEVELDB_PUBLIC_INCLUDE_DIR}/db.h"
  177. "${LEVELDB_PUBLIC_INCLUDE_DIR}/dumpfile.h"
  178. "${LEVELDB_PUBLIC_INCLUDE_DIR}/env.h"
  179. "${LEVELDB_PUBLIC_INCLUDE_DIR}/export.h"
  180. "${LEVELDB_PUBLIC_INCLUDE_DIR}/filter_policy.h"
  181. "${LEVELDB_PUBLIC_INCLUDE_DIR}/iterator.h"
  182. "${LEVELDB_PUBLIC_INCLUDE_DIR}/options.h"
  183. "${LEVELDB_PUBLIC_INCLUDE_DIR}/slice.h"
  184. "${LEVELDB_PUBLIC_INCLUDE_DIR}/status.h"
  185. "${LEVELDB_PUBLIC_INCLUDE_DIR}/table_builder.h"
  186. "${LEVELDB_PUBLIC_INCLUDE_DIR}/table.h"
  187. "${LEVELDB_PUBLIC_INCLUDE_DIR}/write_batch.h"
  188. )
  189. if (WIN32)
  190. target_sources(leveldb
  191. PRIVATE
  192. "util/env_windows.cc"
  193. "util/windows_logger.h"
  194. )
  195. else (WIN32)
  196. target_sources(leveldb
  197. PRIVATE
  198. "util/env_posix.cc"
  199. "util/posix_logger.h"
  200. )
  201. endif (WIN32)
  202. # MemEnv is not part of the interface and could be pulled to a separate library.
  203. target_sources(leveldb
  204. PRIVATE
  205. "helpers/memenv/memenv.cc"
  206. "helpers/memenv/memenv.h"
  207. )
  208. target_include_directories(leveldb
  209. PUBLIC
  210. $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
  211. $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
  212. )
  213. set_target_properties(leveldb
  214. PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
  215. target_compile_definitions(leveldb
  216. PRIVATE
  217. # Used by include/export.h when building shared libraries.
  218. LEVELDB_COMPILE_LIBRARY
  219. # Used by port/port.h.
  220. ${LEVELDB_PLATFORM_NAME}=1
  221. )
  222. if (NOT HAVE_CXX17_HAS_INCLUDE)
  223. target_compile_definitions(leveldb
  224. PRIVATE
  225. LEVELDB_HAS_PORT_CONFIG_H=1
  226. )
  227. endif(NOT HAVE_CXX17_HAS_INCLUDE)
  228. if(BUILD_SHARED_LIBS)
  229. target_compile_definitions(leveldb
  230. PUBLIC
  231. # Used by include/export.h.
  232. LEVELDB_SHARED_LIBRARY
  233. )
  234. endif(BUILD_SHARED_LIBS)
  235. if(HAVE_CLANG_THREAD_SAFETY)
  236. target_compile_options(leveldb
  237. PUBLIC
  238. -Werror -Wthread-safety)
  239. endif(HAVE_CLANG_THREAD_SAFETY)
  240. if(HAVE_CRC32C)
  241. target_link_libraries(leveldb crc32c)
  242. endif(HAVE_CRC32C)
  243. if(HAVE_SNAPPY)
  244. target_link_libraries(leveldb snappy)
  245. endif(HAVE_SNAPPY)
  246. if(HAVE_ZSTD)
  247. target_link_libraries(leveldb zstd)
  248. endif(HAVE_ZSTD)
  249. if(HAVE_TCMALLOC)
  250. target_link_libraries(leveldb tcmalloc)
  251. endif(HAVE_TCMALLOC)
  252. # Needed by port_stdcxx.h
  253. find_package(Threads REQUIRED)
  254. target_link_libraries(leveldb Threads::Threads)
  255. add_executable(leveldbutil
  256. "db/leveldbutil.cc"
  257. )
  258. target_link_libraries(leveldbutil leveldb)
  259. if(LEVELDB_BUILD_TESTS)
  260. enable_testing()
  261. # Prevent overriding the parent project's compiler/linker settings on Windows.
  262. set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
  263. set(install_gtest OFF)
  264. set(install_gmock OFF)
  265. set(build_gmock ON)
  266. # This project is tested using GoogleTest.
  267. add_subdirectory("third_party/googletest")
  268. # GoogleTest triggers a missing field initializers warning.
  269. if(LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS)
  270. set_property(TARGET gtest
  271. APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
  272. set_property(TARGET gmock
  273. APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
  274. endif(LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS)
  275. add_executable(leveldb_tests "")
  276. target_sources(leveldb_tests
  277. PRIVATE
  278. # "db/fault_injection_test.cc"
  279. # "issues/issue178_test.cc"
  280. # "issues/issue200_test.cc"
  281. # "issues/issue320_test.cc"
  282. "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
  283. # "util/env_test.cc"
  284. "util/status_test.cc"
  285. "util/no_destructor_test.cc"
  286. "util/testutil.cc"
  287. "util/testutil.h"
  288. )
  289. if(NOT BUILD_SHARED_LIBS)
  290. target_sources(leveldb_tests
  291. PRIVATE
  292. "db/autocompact_test.cc"
  293. "db/corruption_test.cc"
  294. "db/db_test.cc"
  295. "db/dbformat_test.cc"
  296. "db/filename_test.cc"
  297. "db/log_test.cc"
  298. "db/recovery_test.cc"
  299. "db/skiplist_test.cc"
  300. "db/version_edit_test.cc"
  301. "db/version_set_test.cc"
  302. "db/write_batch_test.cc"
  303. "helpers/memenv/memenv_test.cc"
  304. "table/filter_block_test.cc"
  305. "table/table_test.cc"
  306. "util/arena_test.cc"
  307. "util/bloom_test.cc"
  308. "util/cache_test.cc"
  309. "util/coding_test.cc"
  310. "util/crc32c_test.cc"
  311. "util/hash_test.cc"
  312. "util/logging_test.cc"
  313. )
  314. endif(NOT BUILD_SHARED_LIBS)
  315. target_link_libraries(leveldb_tests leveldb gmock gtest gtest_main)
  316. target_compile_definitions(leveldb_tests
  317. PRIVATE
  318. ${LEVELDB_PLATFORM_NAME}=1
  319. )
  320. if (NOT HAVE_CXX17_HAS_INCLUDE)
  321. target_compile_definitions(leveldb_tests
  322. PRIVATE
  323. LEVELDB_HAS_PORT_CONFIG_H=1
  324. )
  325. endif(NOT HAVE_CXX17_HAS_INCLUDE)
  326. add_test(NAME "leveldb_tests" COMMAND "leveldb_tests")
  327. function(leveldb_test test_file)
  328. get_filename_component(test_target_name "${test_file}" NAME_WE)
  329. add_executable("${test_target_name}" "")
  330. target_sources("${test_target_name}"
  331. PRIVATE
  332. "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
  333. "util/testutil.cc"
  334. "util/testutil.h"
  335. "${test_file}"
  336. )
  337. target_link_libraries("${test_target_name}" leveldb gmock gtest)
  338. target_compile_definitions("${test_target_name}"
  339. PRIVATE
  340. ${LEVELDB_PLATFORM_NAME}=1
  341. )
  342. if (NOT HAVE_CXX17_HAS_INCLUDE)
  343. target_compile_definitions("${test_target_name}"
  344. PRIVATE
  345. LEVELDB_HAS_PORT_CONFIG_H=1
  346. )
  347. endif(NOT HAVE_CXX17_HAS_INCLUDE)
  348. add_test(NAME "${test_target_name}" COMMAND "${test_target_name}")
  349. endfunction(leveldb_test)
  350. leveldb_test("db/c_test.c")
  351. if(NOT BUILD_SHARED_LIBS)
  352. # TODO(costan): This test also uses
  353. # "util/env_{posix|windows}_test_helper.h"
  354. if (WIN32)
  355. leveldb_test("util/env_windows_test.cc")
  356. else (WIN32)
  357. leveldb_test("util/env_posix_test.cc")
  358. endif (WIN32)
  359. endif(NOT BUILD_SHARED_LIBS)
  360. endif(LEVELDB_BUILD_TESTS)
  361. if(LEVELDB_BUILD_BENCHMARKS)
  362. # This project uses Google benchmark for benchmarking.
  363. set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
  364. set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
  365. add_subdirectory("third_party/benchmark")
  366. function(leveldb_benchmark bench_file)
  367. get_filename_component(bench_target_name "${bench_file}" NAME_WE)
  368. add_executable("${bench_target_name}" "")
  369. target_sources("${bench_target_name}"
  370. PRIVATE
  371. "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
  372. "util/histogram.cc"
  373. "util/histogram.h"
  374. "util/testutil.cc"
  375. "util/testutil.h"
  376. "${bench_file}"
  377. )
  378. target_link_libraries("${bench_target_name}" leveldb gmock gtest benchmark)
  379. target_compile_definitions("${bench_target_name}"
  380. PRIVATE
  381. ${LEVELDB_PLATFORM_NAME}=1
  382. )
  383. if (NOT HAVE_CXX17_HAS_INCLUDE)
  384. target_compile_definitions("${bench_target_name}"
  385. PRIVATE
  386. LEVELDB_HAS_PORT_CONFIG_H=1
  387. )
  388. endif(NOT HAVE_CXX17_HAS_INCLUDE)
  389. endfunction(leveldb_benchmark)
  390. if(NOT BUILD_SHARED_LIBS)
  391. leveldb_benchmark("benchmarks/db_bench.cc")
  392. endif(NOT BUILD_SHARED_LIBS)
  393. check_library_exists(sqlite3 sqlite3_open "" HAVE_SQLITE3)
  394. if(HAVE_SQLITE3)
  395. leveldb_benchmark("benchmarks/db_bench_sqlite3.cc")
  396. target_link_libraries(db_bench_sqlite3 sqlite3)
  397. endif(HAVE_SQLITE3)
  398. # check_library_exists is insufficient here because the library names have
  399. # different manglings when compiled with clang or gcc, at least when installed
  400. # with Homebrew on Mac.
  401. set(OLD_CMAKE_REQURED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
  402. list(APPEND CMAKE_REQUIRED_LIBRARIES kyotocabinet)
  403. check_cxx_source_compiles("
  404. #include <kcpolydb.h>
  405. int main() {
  406. kyotocabinet::TreeDB* db = new kyotocabinet::TreeDB();
  407. delete db;
  408. return 0;
  409. }
  410. " HAVE_KYOTOCABINET)
  411. set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQURED_LIBRARIES})
  412. if(HAVE_KYOTOCABINET)
  413. leveldb_benchmark("benchmarks/db_bench_tree_db.cc")
  414. target_link_libraries(db_bench_tree_db kyotocabinet)
  415. endif(HAVE_KYOTOCABINET)
  416. endif(LEVELDB_BUILD_BENCHMARKS)
  417. if(LEVELDB_INSTALL)
  418. install(TARGETS leveldb
  419. EXPORT leveldbTargets
  420. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  421. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  422. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  423. )
  424. install(
  425. FILES
  426. "${LEVELDB_PUBLIC_INCLUDE_DIR}/c.h"
  427. "${LEVELDB_PUBLIC_INCLUDE_DIR}/cache.h"
  428. "${LEVELDB_PUBLIC_INCLUDE_DIR}/comparator.h"
  429. "${LEVELDB_PUBLIC_INCLUDE_DIR}/db.h"
  430. "${LEVELDB_PUBLIC_INCLUDE_DIR}/dumpfile.h"
  431. "${LEVELDB_PUBLIC_INCLUDE_DIR}/env.h"
  432. "${LEVELDB_PUBLIC_INCLUDE_DIR}/export.h"
  433. "${LEVELDB_PUBLIC_INCLUDE_DIR}/filter_policy.h"
  434. "${LEVELDB_PUBLIC_INCLUDE_DIR}/iterator.h"
  435. "${LEVELDB_PUBLIC_INCLUDE_DIR}/options.h"
  436. "${LEVELDB_PUBLIC_INCLUDE_DIR}/slice.h"
  437. "${LEVELDB_PUBLIC_INCLUDE_DIR}/status.h"
  438. "${LEVELDB_PUBLIC_INCLUDE_DIR}/table_builder.h"
  439. "${LEVELDB_PUBLIC_INCLUDE_DIR}/table.h"
  440. "${LEVELDB_PUBLIC_INCLUDE_DIR}/write_batch.h"
  441. DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/leveldb"
  442. )
  443. include(CMakePackageConfigHelpers)
  444. configure_package_config_file(
  445. "cmake/${PROJECT_NAME}Config.cmake.in"
  446. "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake"
  447. INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
  448. )
  449. write_basic_package_version_file(
  450. "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
  451. COMPATIBILITY SameMajorVersion
  452. )
  453. install(
  454. EXPORT leveldbTargets
  455. NAMESPACE leveldb::
  456. DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
  457. )
  458. install(
  459. FILES
  460. "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake"
  461. "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
  462. DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
  463. )
  464. endif(LEVELDB_INSTALL)
  465. add_executable(db_test2
  466. "${PROJECT_SOURCE_DIR}/test/db_test2.cc"
  467. )
  468. target_link_libraries(db_test2 PRIVATE leveldb)
  469. add_executable(ttl_test
  470. "${PROJECT_SOURCE_DIR}/test/ttl_test.cc"
  471. )
  472. target_link_libraries(ttl_test PRIVATE leveldb gtest)