Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: made rocksdb an imported library #7131

Merged
merged 1 commit into from Jan 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Expand Up @@ -660,11 +660,11 @@ add_custom_target(build_rocksdb
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/rocksdb
COMMENT "rocksdb building")

# add a dummy target to attach librocksdb.a and it's include_directories
add_library(rocksdb INTERFACE)
set_target_properties(rocksdb PROPERTIES INTERFACE_LINK_LIBRARIES "${CMAKE_SOURCE_DIR}/src/rocksdb/librocksdb.a")
# add a imported library for librocksdb.a
add_library(rocksdb STATIC IMPORTED)
set_property(TARGET rocksdb PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/src/rocksdb/librocksdb.a")
add_dependencies(rocksdb build_rocksdb)
target_include_directories(rocksdb INTERFACE "${CMAKE_SOURCE_DIR}/src/rocksdb/include")
set(ROCKSDB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/rocksdb/include)

add_subdirectory(kv)

Expand Down
5 changes: 3 additions & 2 deletions src/kv/CMakeLists.txt
Expand Up @@ -3,6 +3,7 @@ set(kv_srcs
LevelDBStore.cc
RocksDBStore.cc)
add_library(kv_objs OBJECT ${kv_srcs})
add_library(kv STATIC ${kv_srcs})
target_include_directories(kv_objs PUBLIC ${CMAKE_SOURCE_DIR}/src/rocksdb/include)
add_library(kv STATIC $<TARGET_OBJECTS:kv_objs>)
target_include_directories(kv_objs PUBLIC ${ROCKSDB_INCLUDE_DIR})
target_include_directories(kv PUBLIC ${ROCKSDB_INCLUDE_DIR})
target_link_libraries(kv bz2 z leveldb snappy rocksdb)
3 changes: 1 addition & 2 deletions src/test/CMakeLists.txt
Expand Up @@ -1414,9 +1414,8 @@ add_executable(unittest_rocksdb_option EXCLUDE_FROM_ALL
)
add_test(unittest_rocksdb_option unittest_rocksdb_option)
add_dependencies(check unittest_rocksdb_option)
target_link_libraries(unittest_rocksdb_option global os rocksdb ${CMAKE_DL_LIBS}
target_link_libraries(unittest_rocksdb_option global os ${CMAKE_DL_LIBS}
${BLKID_LIBRARIES} ${ALLOC_LIBS} ${UNITTEST_LIBS})
target_include_directories(unittest_rocksdb_option PUBLIC ${CMAKE_SOURCE_DIR}/src/rocksdb/include)
set_target_properties(unittest_rocksdb_option PROPERTIES COMPILE_FLAGS ${UNITTEST_CXX_FLAGS})

# unittest_bluefs
Expand Down