[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 12:06:34 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL326358: Fix llvm-config --system-libs output on FreeBSD and NetBSD (authored by dim, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42702?vs=136296&id=136354#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42702

Files:
  llvm/trunk/lib/Support/CMakeLists.txt


Index: llvm/trunk/lib/Support/CMakeLists.txt
===================================================================
--- llvm/trunk/lib/Support/CMakeLists.txt
+++ llvm/trunk/lib/Support/CMakeLists.txt
@@ -13,8 +13,13 @@
   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 "" )
+    # On BSDs, CMake returns a fully qualified path to the backtrace library.
+    # We need to remove the path and the 'lib' prefix, to make it look like a
+    # regular short library name, suitable for appending to a -l link flag.
+    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.136354.patch
Type: text/x-patch
Size: 963 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180228/707b1a4a/attachment.bin>


More information about the llvm-commits mailing list