Skip to content

Commit

Permalink
[flang][runtime] Make sure to link libexecinfo if it exists (llvm#125344
Browse files Browse the repository at this point in the history
)

Fixes building the backtrace support on FreeBSD/NetBSD/OpenBSD/DragonFly and musl
libc with libexecinfo.

(cherry picked from commit cb2598d)
  • Loading branch information
brad0 authored and tstellar committed Feb 5, 2025
1 parent 4123608 commit 8fe8a86
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flang/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
)
endif()

set(linked_libraries FortranDecimal)

# function checks
find_package(Backtrace)
set(HAVE_BACKTRACE ${Backtrace_FOUND})
set(BACKTRACE_HEADER ${Backtrace_HEADER})
if(HAVE_BACKTRACE)
list(APPEND linked_libraries ${Backtrace_LIBRARY})
endif()

include(CheckCXXSymbolExists)
include(CheckCXXSourceCompiles)
Expand Down Expand Up @@ -271,15 +276,15 @@ if (NOT DEFINED MSVC)
add_flang_library(FortranRuntime
${sources}
LINK_LIBS
FortranDecimal
${linked_libraries}

INSTALL_WITH_TOOLCHAIN
)
else()
add_flang_library(FortranRuntime
${sources}
LINK_LIBS
FortranDecimal
${linked_libraries}
)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
add_flang_library(FortranRuntime.static ${sources}
Expand Down

0 comments on commit 8fe8a86

Please sign in to comment.