Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit ba2edd7

Browse files
authored
Merge pull request #107 from bdrewery/llvm-fix-libexecinfo-freebsd
Merging r326358: Fix libexecinfo detection on FreeBSD and NetBSD.
2 parents 5c6b7fe + 05b5e35 commit ba2edd7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/Support/CMakeLists.txt

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ elseif( CMAKE_HOST_UNIX )
1212
if( HAVE_LIBDL )
1313
set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
1414
endif()
15-
if( HAVE_BACKTRACE )
16-
set(system_libs ${system_libs} ${Backtrace_LIBRARIES})
15+
if( HAVE_BACKTRACE AND NOT "${Backtrace_LIBRARIES}" STREQUAL "" )
16+
# On BSDs, CMake returns a fully qualified path to the backtrace library.
17+
# We need to remove the path and the 'lib' prefix, to make it look like a
18+
# regular short library name, suitable for appending to a -l link flag.
19+
get_filename_component(Backtrace_LIBFILE ${Backtrace_LIBRARIES} NAME_WE)
20+
STRING(REGEX REPLACE "^lib" "" Backtrace_LIBFILE ${Backtrace_LIBFILE})
21+
set(system_libs ${system_libs} ${Backtrace_LIBFILE})
1722
endif()
1823
if(LLVM_ENABLE_TERMINFO)
1924
if(HAVE_TERMINFO)

0 commit comments

Comments
 (0)