[PATCH] D69412: build: avoid hardcoding the libxml2 library name

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 15:14:17 PDT 2019


compnerd created this revision.
compnerd added reviewers: xiaobai, beanz.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.

`FindLibXml2` will set the `LIBXML2_LIBRARIES` variable to the libraries that we must link against.  This will be an empty string if libxml2 is not found.  Avoid hardcoding the library name as `xml2` in the configuration.  Simplify the usage in the WindowsManifest library.


Repository:
  rL LLVM

https://reviews.llvm.org/D69412

Files:
  cmake/config-ix.cmake
  lib/WindowsManifest/CMakeLists.txt


Index: lib/WindowsManifest/CMakeLists.txt
===================================================================
--- lib/WindowsManifest/CMakeLists.txt
+++ lib/WindowsManifest/CMakeLists.txt
@@ -1,10 +1,3 @@
-set(system_libs)
-if( CMAKE_HOST_UNIX )
-  if( LLVM_LIBXML2_ENABLED )
-    set(system_libs ${system_libs} ${LIBXML2_LIBS})
-  endif()
-endif()
-
 add_llvm_library(LLVMWindowsManifest
   WindowsManifestMerger.cpp
 
@@ -12,7 +5,7 @@
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/WindowsManifest
   ${Backtrace_INCLUDE_DIRS}
 
-  LINK_LIBS ${system_libs}
+  LINK_LIBS ${LIBXML2_LIBRARIES}
   )
-
-set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")
+set_target_properties(LLVMWindowsManifest PROPERTIES
+  LLVM_SYSTEM_LIBS ${LIBXML2_LIBRARIES})
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -166,7 +166,6 @@
         else()
           include_directories(${LIBXML2_INCLUDE_DIR})
         endif()
-        set(LIBXML2_LIBS "xml2")
       endif()
     endif()
   endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69412.226342.patch
Type: text/x-patch
Size: 1097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191024/e5e91f66/attachment.bin>


More information about the llvm-commits mailing list