From c8071efd44b4286c0eee735539eb91068fb263ed Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 27 Nov 2019 12:34:36 -0800 Subject: [PATCH] build: avoid hardcoding the libxml2 library name 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. --- cmake/config-ix.cmake | 1 - lib/WindowsManifest/CMakeLists.txt | 12 +++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 028a2cc86bf..e7e5e5dcf2f 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -166,7 +166,6 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") else() include_directories(${LIBXML2_INCLUDE_DIR}) endif() - set(LIBXML2_LIBS "xml2") endif() endif() endif() diff --git a/lib/WindowsManifest/CMakeLists.txt b/lib/WindowsManifest/CMakeLists.txt index 4f2d011d543..8868564da76 100644 --- a/lib/WindowsManifest/CMakeLists.txt +++ b/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_component_library(LLVMWindowsManifest WindowsManifestMerger.cpp @@ -12,7 +5,8 @@ add_llvm_component_library(LLVMWindowsManifest ${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_property(TARGET LLVMWindowsManifest PROPERTY + LLVM_SYSTEM_LIBS ${LIBXML2_LIBRARIES})