Skip to content

Commit

Permalink
914: build: add -rdynamic to fix stack traces
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Jul 10, 2020
1 parent 590704a commit b823eac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ endif()
include(SetCXXCompilerFlags)
set_darma_compiler_flags()

include(cmake/set_linker_flags.cmake)

# Code coverage option of VT
option(CODE_COVERAGE "Enable coverage reporting" OFF)
# OPTION(CODE_COVERAGE_ENABLED FALSE)
Expand Down
14 changes: 14 additions & 0 deletions cmake-modules/CheckLinkerFlag.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
include(CheckCXXCompilerFlag)

if(POLICY CMP0056)
# Honor link flags in try_compile() source-file signature.
cmake_policy(SET CMP0056 NEW)
endif()

# This is written because cmake does not support `check_linker_flag` until 3.18
function(check_linker_flag flag out_var)
set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
check_cxx_compiler_flag("" ${out_var})
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endfunction()
7 changes: 7 additions & 0 deletions cmake/set_linker_flags.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include(CheckLinkerFlag)

check_linker_flag(-rdynamic LINK_SUPPORTS_RDYNAMIC)

if (LINK_SUPPORT_RDYNAMIC)
target_link_options(${VIRTUAL_TRANSPORT_LIBRARY} INTERFACE -rdynamic)
endif()

0 comments on commit b823eac

Please sign in to comment.