Skip to content

Commit

Permalink
build: change the logic to select Boost stacktrace component;
Browse files Browse the repository at this point in the history
if stacktrace_backtrace is not available, fall back to stacktrace_basic
  • Loading branch information
ban-nobuhiro committed Dec 6, 2024
1 parent dfa6928 commit d2bbc0f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,18 @@ find_package(ICU 60
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(boost_stacktrace_component stacktrace_backtrace)
find_package(Boost 1.65
COMPONENTS container
COMPONENTS ${boost_stacktrace_component}
OPTIONAL_COMPONENTS stacktrace_backtrace stacktrace_basic
REQUIRED)
if(Boost_STACKTRACE_BACKTRACE_FOUND
AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER MATCHES "Clang"))
set(boost_stacktrace_component stacktrace_backtrace)
elseif(Boost_STACKTRACE_BASIC_FOUND)
set(boost_stacktrace_component stacktrace_basic)
else()
message(FATAL_ERROR "No usable Boost stacktrace component")
endif()

find_package(Doxygen
OPTIONAL_COMPONENTS dot)
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ target_compile_definitions(takatori
PUBLIC BOOST_ENABLE_ASSERT_DEBUG_HANDLER
)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (boost_stacktrace_component STREQUAL "stacktrace_backtrace")
target_link_libraries(takatori
PUBLIC Boost::stacktrace_backtrace
PUBLIC ${CMAKE_DL_LIBS}
Expand All @@ -254,9 +254,9 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
PUBLIC BOOST_STACKTRACE_USE_BACKTRACE
)
else()
# FIXME: more compilers
target_link_libraries(takatori
PUBLIC Boost::stacktrace_noop
PUBLIC Boost::stacktrace_basic
PUBLIC ${CMAKE_DL_LIBS}
)
endif()

Expand Down

0 comments on commit d2bbc0f

Please sign in to comment.