Skip to content

Commit c3595d1

Browse files
committed
build: process the libxml2 library path for embedding
Process the path for libxml2 before embedding that into the command line that is generated in `llvm-config`. Each element in the path is being given a `-l` unconditionally which should not be the case for absolute paths. Since the library path may be absolute or not, just apply some CMake pre-processing when generating the path. Before: ``` /usr/lib/x86_64-linux-gnu/libz.so -lrt -ldl -ltinfo -lpthread -lm /usr/lib/x86_64-linux-gnu/libxml2.so ``` After: ``` /usr/lib/x86_64-linux-gnu/libz.so -lrt -ldl -ltinfo -lpthread -lm -lxml2 ``` Resolves PR44179!
1 parent 76128cf commit c3595d1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

llvm/lib/WindowsManifest/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ add_llvm_component_library(LLVMWindowsManifest
77

88
if(LIBXML2_LIBRARIES)
99
target_link_libraries(LLVMWindowsManifest PUBLIC ${LIBXML2_LIBRARIES})
10+
11+
get_filename_component(xml2_library ${LIBXML2_LIBRARIES} NAME)
12+
if(xml2_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$")
13+
string(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" xml2_library ${xml2_library})
14+
string(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" xml2_library ${xml2_library})
15+
elseif(xml2_library MATCHES "^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$")
16+
string(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" xml2_library ${xml2_library})
17+
string(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "" xml2_library ${xml2_library})
18+
endif()
1019
set_property(TARGET LLVMWindowsManifest PROPERTY
11-
LLVM_SYSTEM_LIBS ${LIBXML2_LIBRARIES})
20+
LLVM_SYSTEM_LIBS ${xml2_library})
1221
endif()

0 commit comments

Comments
 (0)