Skip to content
Permalink
Browse files
Merge pull request #1799 from renzhong/cmake_snappy
support with_snappy in cmake
  • Loading branch information
serverglen committed Jun 19, 2022
2 parents 7a1c130 + 5d32732 commit eb6d65b5b216eb1bb3cff5da84db182dd8732d3a
Showing 1 changed file with 15 additions and 0 deletions.
@@ -23,6 +23,7 @@ option(WITH_MESALINK "With MesaLink" OFF)
option(DEBUG "Print debug logs" OFF)
option(WITH_DEBUG_SYMBOLS "With debug symbols" ON)
option(WITH_THRIFT "With thrift framed protocol supported" OFF)
option(WITH_SNAPPY "With snappy" OFF)
option(BUILD_UNIT_TESTS "Whether to build unit tests" OFF)
option(DOWNLOAD_GTEST "Download and build a fresh copy of googletest. Requires Internet access." ON)

@@ -151,6 +152,15 @@ if ((NOT LEVELDB_INCLUDE_PATH) OR (NOT LEVELDB_LIB))
message(FATAL_ERROR "Fail to find leveldb")
endif()

if(WITH_SNAPPY)
find_path(SNAPPY_INCLUDE_PATH NAMES snappy.h)
find_library(SNAPPY_LIB NAMES snappy)
if ((NOT SNAPPY_INCLUDE_PATH) OR (NOT SNAPPY_LIB))
message(FATAL_ERROR "Fail to find snappy")
endif()
include_directories(${SNAPPY_INCLUDE_PATH})
endif()

if(WITH_GLOG)
find_path(GLOG_INCLUDE_PATH NAMES glog/logging.h)
find_library(GLOG_LIB NAMES glog)
@@ -216,6 +226,11 @@ if(WITH_GLOG)
set(BRPC_PRIVATE_LIBS "${BRPC_PRIVATE_LIBS} -lglog")
endif()

if(WITH_SNAPPY)
set(DYNAMIC_LIB ${DYNAMIC_LIB} ${SNAPPY_LIB})
set(BRPC_PRIVATE_LIBS "${BRPC_PRIVATE_LIBS} -lsnappy")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(DYNAMIC_LIB ${DYNAMIC_LIB} rt)
set(BRPC_PRIVATE_LIBS "${BRPC_PRIVATE_LIBS} -lrt")

0 comments on commit eb6d65b

Please sign in to comment.