Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve libunwind linking in CMake #1079

Merged
merged 1 commit into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is default ON in glog, so we just forward it here.


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}
)