]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/driver/dbstore/CMakeLists.txt
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rgw / driver / dbstore / CMakeLists.txt
1 #need to update cmake version here
2 cmake_minimum_required(VERSION 3.14.0)
3 project(dbstore)
4
5 option(USE_SQLITE "Enable SQLITE DB" ON)
6
7 set (CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/common")
8
9 set(dbstore_srcs
10 common/dbstore_log.h
11 common/dbstore.h
12 common/dbstore.cc
13 config/store.cc)
14 IF(USE_SQLITE)
15 list(APPEND dbstore_srcs
16 config/sqlite.cc
17 sqlite/connection.cc
18 sqlite/error.cc
19 sqlite/statement.cc)
20 endif()
21
22 set(dbstore_mgr_srcs
23 dbstore_mgr.h
24 dbstore_mgr.cc
25 )
26
27 add_library(dbstore_lib ${dbstore_srcs})
28 target_include_directories(dbstore_lib
29 PUBLIC "${CMAKE_SOURCE_DIR}/src/rgw"
30 PUBLIC "${CMAKE_SOURCE_DIR}/src/rgw/store/rados"
31 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
32 set(link_targets spawn)
33 if(WITH_JAEGER)
34 list(APPEND link_targets jaeger_base)
35 endif()
36 list(APPEND link_targets rgw_common)
37 target_link_libraries(dbstore_lib PUBLIC ${link_targets})
38
39 set (CMAKE_LINK_LIBRARIES ${CMAKE_LINK_LIBRARIES} dbstore_lib)
40
41 IF(USE_SQLITE)
42 add_subdirectory(sqlite)
43 set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/sqlite")
44 add_compile_definitions(SQLITE_ENABLED=1)
45 set (CMAKE_LINK_LIBRARIES ${CMAKE_LINK_LIBRARIES} rgw_common)
46 set (CMAKE_LINK_LIBRARIES ${CMAKE_LINK_LIBRARIES} sqlite_db)
47 add_dependencies(sqlite_db dbstore_lib)
48 ENDIF()
49
50 # add pthread library
51 set (CMAKE_LINK_LIBRARIES ${CMAKE_LINK_LIBRARIES} pthread)
52
53 find_package(gtest QUIET)
54 if(WITH_TESTS)
55 add_subdirectory(tests)
56 else()
57 message(WARNING "Gtest not enabled")
58 endif()
59
60 include_directories(${CMAKE_INCLUDE_DIR})
61 add_library(dbstore STATIC ${dbstore_mgr_srcs})
62 target_link_libraries(dbstore ${CMAKE_LINK_LIBRARIES})
63
64 # testing purpose
65 set(dbstore_main_srcs
66 dbstore_main.cc)
67
68 set (CMAKE_LINK_LIBRARIES ${CMAKE_LINK_LIBRARIES} dbstore)
69 add_executable(dbstore-bin ${dbstore_main_srcs})
70 add_dependencies(dbstore-bin dbstore)
71 target_link_libraries(dbstore-bin ${CMAKE_LINK_LIBRARIES})