mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 11:39:02 +08:00
92 lines
2.9 KiB
Diff
92 lines
2.9 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index cbbde8e..cb19649 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -315,10 +315,13 @@ endif()
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR})
|
|
include_directories(${PROJECT_SOURCE_DIR}/include)
|
|
-include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third-party/gtest-1.7.0/fused-src)
|
|
+
|
|
find_package(Threads REQUIRED)
|
|
|
|
-add_subdirectory(third-party/gtest-1.7.0/fused-src/gtest)
|
|
+if(BUILD_TEST)
|
|
+ include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third-party/gtest-1.7.0/fused-src)
|
|
+ add_subdirectory(third-party/gtest-1.7.0/fused-src/gtest)
|
|
+endif()
|
|
|
|
# Main library source code
|
|
|
|
@@ -574,22 +577,28 @@ if(WITH_LIBRADOS)
|
|
list(APPEND THIRDPARTY_LIBS rados)
|
|
endif()
|
|
|
|
-add_library(${ROCKSDB_STATIC_LIB} STATIC ${SOURCES})
|
|
-target_link_libraries(${ROCKSDB_STATIC_LIB}
|
|
+if(BUILD_STATIC_LIBRARY)
|
|
+ add_library(${ROCKSDB_STATIC_LIB} STATIC ${SOURCES})
|
|
+ target_link_libraries(${ROCKSDB_STATIC_LIB}
|
|
${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
|
|
-
|
|
-if(WIN32)
|
|
- 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")
|
|
if(MSVC)
|
|
set_target_properties(${ROCKSDB_STATIC_LIB} PROPERTIES
|
|
- COMPILE_FLAGS "/Fd${CMAKE_CFG_INTDIR}/${ROCKSDB_STATIC_LIB}.pdb")
|
|
+ COMPILE_FLAGS "/Fd${CMAKE_CFG_INTDIR}/${ROCKSDB_STATIC_LIB}.pdb")
|
|
+ endif()
|
|
+ set(INSTALL_TARGETS ${INSTALL_TARGETS} ${ROCKSDB_STATIC_LIB})
|
|
+else()
|
|
+ if(WIN32)
|
|
+ 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")
|
|
+ if(MSVC)
|
|
+ set_target_properties(${ROCKSDB_IMPORT_LIB} PROPERTIES
|
|
COMPILE_FLAGS "/Fd${CMAKE_CFG_INTDIR}/${ROCKSDB_IMPORT_LIB}.pdb")
|
|
+ endif()
|
|
endif()
|
|
+ set(INSTALL_TARGETS ${INSTALL_TARGETS} ${ROCKSDB_IMPORT_LIB})
|
|
endif()
|
|
|
|
option(WITH_JNI "build with JNI" OFF)
|
|
@@ -600,6 +609,7 @@ else()
|
|
message(STATUS "JNI library is disabled")
|
|
endif()
|
|
|
|
+if(BUILD_TEST)
|
|
set(TESTS
|
|
cache/cache_test.cc
|
|
cache/lru_cache_test.cc
|
|
@@ -810,6 +820,7 @@ foreach(sourcefile ${C_TEST_EXES})
|
|
add_dependencies(check ${exename}${ARTIFACT_SUFFIX})
|
|
endforeach(sourcefile ${C_TEST_EXES})
|
|
add_subdirectory(tools)
|
|
+endif()
|
|
|
|
# Installation and packaging for Linux
|
|
if(NOT WIN32)
|
|
@@ -819,4 +830,15 @@ install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/rocksdb/"
|
|
COMPONENT devel
|
|
DESTINATION include/rocksdb)
|
|
set(CMAKE_INSTALL_PREFIX /usr)
|
|
+else()
|
|
+ install(
|
|
+ TARGETS ${INSTALL_TARGETS}
|
|
+ RUNTIME DESTINATION bin
|
|
+ LIBRARY DESTINATION lib
|
|
+ ARCHIVE DESTINATION lib
|
|
+ )
|
|
+endif()
|
|
+
|
|
+if(NOT DISABLE_INSTALL_HEADERS)
|
|
+ install(DIRECTORY "include/rocksdb/" DESTINATION include/rocksdb)
|
|
endif()
|