Skip to content

Commit dc090e9

Browse files
pavelxddalexrp
authored andcommitted
cmake: support static linking against libxml2
1 parent 5be3c78 commit dc090e9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ set(ZIG_STATIC_LLVM ${ZIG_STATIC} CACHE BOOL "Prefer linking against static LLVM
9090
set(ZIG_STATIC_ZLIB ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zlib")
9191
set(ZIG_STATIC_ZSTD ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zstd")
9292
set(ZIG_STATIC_CURSES OFF CACHE BOOL "Enable static linking against curses")
93+
set(ZIG_STATIC_LIBXML2 OFF CACHE BOOL "Enable static linking against libxml2")
9394

9495
if (ZIG_SHARED_LLVM AND ZIG_STATIC_LLVM)
9596
message(SEND_ERROR "-DZIG_SHARED_LLVM and -DZIG_STATIC_LLVM cannot both be enabled simultaneously")
@@ -167,6 +168,12 @@ if(ZIG_STATIC_CURSES)
167168
list(APPEND LLVM_LIBRARIES "${CURSES}")
168169
endif()
169170

171+
if(ZIG_STATIC_LIBXML2)
172+
list(REMOVE_ITEM LLVM_LIBRARIES "-lxml2")
173+
find_library(LIBXML2 NAMES libxml2.a NAMES_PER_DIR)
174+
list(APPEND LLVM_LIBRARIES "${LIBXML2}")
175+
endif()
176+
170177
find_package(Threads)
171178

172179
set(ZIG_CONFIG_H_OUT "${PROJECT_BINARY_DIR}/config.h")

0 commit comments

Comments
 (0)