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

fall back to Boost::stacktrace_basic if Boost::stacktrace_backtrace is not available #40

Merged
merged 2 commits into from
Dec 10, 2024
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
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@ set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.65
COMPONENTS container
COMPONENTS stacktrace_backtrace
OPTIONAL_COMPONENTS stacktrace_backtrace stacktrace_basic
REQUIRED)
if(Boost_STACKTRACE_BACKTRACE_FOUND
AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID 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
3 changes: 3 additions & 0 deletions cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
include(CMakeFindDependencyMacro)
find_dependency(Boost 1.65 COMPONENTS @boost_stacktrace_component@ REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
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