Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #7229 from EOSIO/mongo_snappy_linking
Browse files Browse the repository at this point in the history
link to snappy when appropriate for mongo
  • Loading branch information
arhag authored Apr 29, 2019
2 parents a68aefb + a6a172b commit 4f3009f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions plugins/mongo_db_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ if(BUILD_MONGO_DB_PLUGIN)

# We can't just use *_STATIC_LIBRARIES variables to link against because the static
# variants of these may try to static link against libraries we don't want (like a system
# libc/c++). But we need to know if mongo c driver was built with ICU or SASL2 support so
# that we can continue to link to those. This certainly is a bit on the fragile side but
# libc/c++). But we need to know if mongo c driver was built with ICU, SASL2, or snappy support
# so that we can continue to link to those. This certainly is a bit on the fragile side but
# try to parse what is included in MONGOC_STATIC_LIBRARIES to see what we should link to
foreach(MONGO_S_LIB ${MONGOC_STATIC_LIBRARIES})
string(REGEX MATCH "libsasl2\\${CMAKE_SHARED_LIBRARY_SUFFIX}$" REGOUT ${MONGO_S_LIB})
Expand All @@ -44,15 +44,20 @@ if(BUILD_MONGO_DB_PLUGIN)
if(REGOUT)
set(LINK_ICU "icuuc")
endif()

string(REGEX MATCH "libsnappy\\${CMAKE_SHARED_LIBRARY_SUFFIX}$" REGOUT ${MONGO_S_LIB})
if(REGOUT)
set(LINK_SNAPPY "snappy")
endif()
endforeach()

target_link_libraries(mongo_db_plugin
PUBLIC chain_plugin eosio_chain appbase
${LIBMONGOCXX_STATIC_LIBRARY_PATH} ${LIBBSONCXX_STATIC_LIBRARY_PATH}
${MONGOC_STATIC_LIBRARY} ${BSON_STATIC_LIBRARY}
resolv ${LINK_SASL} ${LINK_ICU}
resolv ${LINK_SASL} ${LINK_ICU} ${LINK_SNAPPY}
)

else()
message("mongo_db_plugin not selected and will be omitted.")
endif()

0 comments on commit 4f3009f

Please sign in to comment.