Skip to content

Commit

Permalink
Improve libunwind linking in CMake (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice committed Nov 9, 2022
1 parent 2a8a64b commit 1995d5f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ option(ASAN_WITH_LSAN "enable leak santinizer while address santinizer is enable
option(ENABLE_STATIC_LIBSTDCXX "link kvrocks with static library of libstd++ instead of shared library" ON)
option(USE_LUAJIT "use luaJIT instead of lua" OFF)
option(ENABLE_OPENSSL "enable openssl to support tls connection" OFF)
option(ENABLE_UNWIND "enable libunwind in glog" ON)

if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
Expand Down Expand Up @@ -163,8 +164,6 @@ if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "C
endif()
endif()

find_library(FOUND_UNWIND_LIB unwind)

# kvrocks objects target
file(GLOB_RECURSE KVROCKS_SRCS src/*.cc)
list(FILTER KVROCKS_SRCS EXCLUDE REGEX src/main.cc)
Expand All @@ -181,9 +180,6 @@ elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQU
endif()
target_link_libraries(kvrocks_objs PUBLIC -fno-omit-frame-pointer)
target_link_libraries(kvrocks_objs PUBLIC ${EXTERNAL_LIBS})
if(FOUND_UNWIND_LIB)
target_link_libraries(kvrocks_objs PUBLIC ${FOUND_UNWIND_LIB})
endif()
if(ENABLE_OPENSSL)
target_compile_definitions(kvrocks_objs PUBLIC ENABLE_OPENSSL)
endif()
Expand Down
1 change: 1 addition & 0 deletions cmake/glog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ FetchContent_MakeAvailableWithArgs(glog
WITH_GFLAGS=OFF
WITH_GTEST=OFF
BUILD_SHARED_LIBS=OFF
WITH_UNWIND=${ENABLE_UNWIND}
)

0 comments on commit 1995d5f

Please sign in to comment.