forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from uilianries/rocksdb-646
fix: shared build for rocksdb
- Loading branch information
Showing
6 changed files
with
94 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
PROJECT(conancmakewrapper) | ||
|
||
message(STATUS "Conan CMake Wrapper") | ||
set(CMAKE_VERBOSE_MAKEFILE ON) | ||
|
||
include("${CMAKE_SOURCE_DIR}/conanbuildinfo.cmake") | ||
CONAN_BASIC_SETUP() | ||
|
||
include("CMakeListsOriginal.cmake") | ||
add_subdirectory("source_subfolder") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 7266f3b..b8f6397 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -772,6 +772,7 @@ else() | ||
set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT}) | ||
set(LIBS ${ROCKSDB_SHARED_LIB} ${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) | ||
|
||
+ if (BUILD_SHARED_LIBS) | ||
add_library(${ROCKSDB_SHARED_LIB} SHARED ${SOURCES}) | ||
target_link_libraries(${ROCKSDB_SHARED_LIB} | ||
${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) | ||
@@ -781,18 +782,23 @@ else() | ||
SOVERSION ${ROCKSDB_VERSION_MAJOR} | ||
CXX_STANDARD 11 | ||
OUTPUT_NAME "rocksdb") | ||
+ endif() | ||
endif() | ||
|
||
+if (NOT BUILD_SHARED_LIBS) | ||
add_library(${ROCKSDB_STATIC_LIB} STATIC ${SOURCES}) | ||
target_link_libraries(${ROCKSDB_STATIC_LIB} | ||
${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) | ||
+endif() | ||
|
||
if(WIN32) | ||
+ if (BUILD_SHARED_LIBS) | ||
add_library(${ROCKSDB_IMPORT_LIB} SHARED ${SOURCES}) | ||
target_link_libraries(${ROCKSDB_IMPORT_LIB} | ||
${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) | ||
set_target_properties(${ROCKSDB_IMPORT_LIB} PROPERTIES | ||
COMPILE_DEFINITIONS "ROCKSDB_DLL;ROCKSDB_LIBRARY_EXPORTS") | ||
+ endif() | ||
if(MSVC) | ||
set_target_properties(${ROCKSDB_STATIC_LIB} PROPERTIES | ||
COMPILE_FLAGS "/Fd${CMAKE_CFG_INTDIR}/${ROCKSDB_STATIC_LIB}.pdb") | ||
@@ -839,6 +845,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS) | ||
|
||
install(DIRECTORY include/rocksdb COMPONENT devel DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") | ||
|
||
+ if (NOT BUILD_SHARED_LIBS) | ||
install( | ||
TARGETS ${ROCKSDB_STATIC_LIB} | ||
EXPORT RocksDBTargets | ||
@@ -846,6 +853,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS) | ||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
) | ||
+ else() | ||
|
||
install( | ||
TARGETS ${ROCKSDB_SHARED_LIB} | ||
@@ -856,6 +864,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS) | ||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
) | ||
+ endif() | ||
|
||
install( | ||
EXPORT RocksDBTargets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
project(test_package) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_VERBOSE_MAKEFILE TRUE) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
|
||
#include <cassert> | ||
|
||
#include <cstdlib> | ||
#include "rocksdb/db.h" | ||
|
||
int main() { | ||
rocksdb::DB* db; | ||
rocksdb::Options options; | ||
options.create_if_missing = true; | ||
rocksdb::Status status = rocksdb::DB::Open(options, "./testdb", &db); | ||
assert(status.ok()); | ||
rocksdb::Status status = rocksdb::DB::Open(options, "testdb", &db); | ||
status.ok(); | ||
|
||
return EXIT_SUCCESS; | ||
} |