1include(GetLibraryName)
2
3if(LLVM_ENABLE_LIBXML2)
4  set(imported_libs LibXml2::LibXml2)
5endif()
6
7add_llvm_component_library(LLVMWindowsManifest
8  WindowsManifestMerger.cpp
9
10  ADDITIONAL_HEADER_DIRS
11  ${LLVM_MAIN_INCLUDE_DIR}/llvm/WindowsManifest
12  ${Backtrace_INCLUDE_DIRS}
13
14  LINK_LIBS
15  ${imported_libs}
16
17  LINK_COMPONENTS
18  Support
19  )
20
21# This block is only needed for llvm-config. When we deprecate llvm-config and
22# move to using CMake export, this block can be removed.
23if(LLVM_ENABLE_LIBXML2)
24  # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
25  if(CMAKE_BUILD_TYPE)
26    string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
27    get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION_${build_type})
28  endif()
29  if(NOT zlib_library)
30    get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION)
31  endif()
32  get_library_name(${libxml2_library} libxml2_library)
33  set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${libxml2_library})
34endif()
35