[PATCH] D42702: Fix llvm-config --system-libs output on FreeBSD and NetBSD

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 08:04:14 PST 2018


dim updated this revision to Diff 136296.
dim added a comment.

Update using @bdrewery's suggestion, with one small fix for Linux, where
`Backtrace_LIBRARIES` is usually an empty string.

Resulting output on FreeBSD:

  $ ./bin/llvm-config --system-libs
  -lz -lrt -lexecinfo -ltinfo -lpthread -lm
  $ ./bin/llvm-config --system-libs --link-static
  -lz -lrt -lexecinfo -ltinfo -lpthread -lm

On Ubuntu 17.10:

  $ ./bin/llvm-config --system-libs
  -lz -lrt -ldl -ltinfo -lpthread -lm
  $ ./bin/llvm-config --system-libs --link-static
  -lz -lrt -ldl -ltinfo -lpthread -lm


Repository:
  rL LLVM

https://reviews.llvm.org/D42702

Files:
  lib/Support/CMakeLists.txt


Index: lib/Support/CMakeLists.txt
===================================================================
--- lib/Support/CMakeLists.txt
+++ lib/Support/CMakeLists.txt
@@ -13,8 +13,10 @@
   if( HAVE_LIBDL )
     set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
   endif()
-  if( HAVE_BACKTRACE )
-    set(system_libs ${system_libs} ${Backtrace_LIBRARIES})
+  if( HAVE_BACKTRACE AND NOT "${Backtrace_LIBRARIES}" STREQUAL "" )
+    get_filename_component(Backtrace_LIBFILE ${Backtrace_LIBRARIES} NAME_WE)
+    STRING(REGEX REPLACE "^lib" "" Backtrace_LIBFILE ${Backtrace_LIBFILE})
+    set(system_libs ${system_libs} ${Backtrace_LIBFILE})
   endif()
   if(LLVM_ENABLE_TERMINFO)
     if(HAVE_TERMINFO)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42702.136296.patch
Type: text/x-patch
Size: 695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180228/6e26454c/attachment.bin>


More information about the llvm-commits mailing list