llvm-config: do not link absolute paths with `-l`
authorSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 3 Dec 2019 16:52:21 +0000 (08:52 -0800)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 3 Dec 2019 16:54:09 +0000 (08:54 -0800)
When dealing with system libraries which are absolute paths, use the
absolute path rather than the `-l` option.  This ensures that the system
library can be properly linked against.  This is needed to enable using
proper link dependencies in CMake.

llvm/tools/llvm-config/CMakeLists.txt

index 9ab1d28..16ba54c 100644 (file)
@@ -20,7 +20,11 @@ foreach(l ${SUPPORT_SYSTEM_LIBS} ${WINDOWSMANIFEST_SYSTEM_LIBS})
       set(SYSTEM_LIBS ${SYSTEM_LIBS} "${l}")
     else()
       # Otherwise assume it's a library name we need to link with.
-      set(SYSTEM_LIBS ${SYSTEM_LIBS} "-l${l}")
+      if(IS_ABSOLUTE ${l})
+        set(SYSTEM_LIBS ${SYSTEM_LIBS} "${l}")
+      else()
+        set(SYSTEM_LIBS ${SYSTEM_LIBS} "-l${l}")
+      endif()
     endif()
   endif()
 endforeach()