diff --git a/CMakeLists.txt b/CMakeLists.txt index f9c8f3346..74c2d263c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -938,13 +938,17 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS) install(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/modules" COMPONENT devel DESTINATION ${package_config_destination}) - install( - TARGETS ${ROCKSDB_STATIC_LIB} - EXPORT RocksDBTargets - COMPONENT devel - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - ) + if(NOT ROCKSDB_BUILD_SHARED) + install( + TARGETS ${ROCKSDB_STATIC_LIB} + EXPORT RocksDBTargets + COMPONENT devel + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + else() + set_target_properties(${ROCKSDB_STATIC_LIB} PROPERTIES EXCLUDE_FROM_ALL TRUE) + endif() if(ROCKSDB_BUILD_SHARED) install(