Skip to content

Commit

Permalink
Add the option building static or shared libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
yc1111 committed Jan 31, 2024
1 parent c1077d5 commit 8cdeaae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
OPTION(LEDGERDB "Use LedgerDB" ON)
OPTION(AMZQLDB "Use QLDB" OFF)
OPTION(SQLLEDGER "Use SQL Ledger" OFF)
OPTION(BUILD_STATIC_LIBS "Build static libraries" OFF)

if(LEDGERDB)
message(STATUS "Use LedgerDB")
Expand Down
6 changes: 5 additions & 1 deletion distributed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ LIST(APPEND dist_srcs ${lib_srcs})
ADD_LIBRARY(dist_objs OBJECT ${dist_srcs})
ADD_DEPENDENCIES(dist_objs copy_dist_protobuf)

ADD_LIBRARY(dist SHARED $<TARGET_OBJECTS:dist_objs>)
if (BUILD_STATIC_LIBS)
ADD_LIBRARY(dist STATIC $<TARGET_OBJECTS:dist_objs>)
else()
ADD_LIBRARY(dist SHARED $<TARGET_OBJECTS:dist_objs>)
endif()
LIST(APPEND DIST_LINKER_LIBS event_openssl)
LIST(APPEND DIST_LINKER_LIBS tbb)
LIST(APPEND DIST_LINKER_LIBS crypto)
Expand Down
6 changes: 5 additions & 1 deletion ledger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ AUX_SOURCE_DIRECTORY(sqlledger sqlledger_srcs)
LIST(APPEND ledger_srcs ${sqlledger_srcs})

ADD_LIBRARY(ledger_objs OBJECT ${ledger_srcs})
ADD_LIBRARY(ledger SHARED $<TARGET_OBJECTS:ledger_objs>)
if (BUILD_STATIC_LIBS)
ADD_LIBRARY(ledger STATIC $<TARGET_OBJECTS:ledger_objs>)
else()
ADD_LIBRARY(ledger SHARED $<TARGET_OBJECTS:ledger_objs>)
endif()

LIST(APPEND LEDGER_LINKER_LIBS tbb)
TARGET_LINK_LIBRARIES(ledger ${LEDGER_LINKER_LIBS})

0 comments on commit 8cdeaae

Please sign in to comment.