1add_llvm_component_library(LLVMWindowsManifest
2  WindowsManifestMerger.cpp
3
4  ADDITIONAL_HEADER_DIRS
5  ${LLVM_MAIN_INCLUDE_DIR}/llvm/WindowsManifest
6  ${Backtrace_INCLUDE_DIRS})
7
8if(LIBXML2_LIBRARIES)
9  target_link_libraries(LLVMWindowsManifest PUBLIC ${LIBXML2_LIBRARIES})
10
11  get_filename_component(xml2_library ${LIBXML2_LIBRARIES} NAME)
12  if (CMAKE_STATIC_LIBRARY_PREFIX AND
13      xml2_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$")
14    string(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" xml2_library ${xml2_library})
15    string(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" xml2_library ${xml2_library})
16  elseif (CMAKE_SHARED_LIBRARY_PREFIX AND
17          xml2_library MATCHES "^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$")
18    string(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" xml2_library ${xml2_library})
19    string(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "" xml2_library ${xml2_library})
20  endif()
21  set_property(TARGET LLVMWindowsManifest PROPERTY
22    LLVM_SYSTEM_LIBS ${xml2_library})
23endif()
24