--- CMakeLists.txt.orig	2023-08-11 18:59:11 UTC
+++ CMakeLists.txt
@@ -395,13 +395,17 @@ if(LIBXML2_WITH_ICU)
 	if(WIN32)
 		set(ICU_LIBS "-licudt -licuin -licuuc")
 	else()
-		set(ICU_LIBS "-licudata -licui18n -licuuc")
+		set(ICU_LIBS_DIR "${ICU_INCLUDE_DIRS}")
+		STRING(REGEX REPLACE "include" "lib" ICU_LIBS_DIR ${ICU_LIBS_DIR})
+		set(ICU_LIBS "-L${ICU_LIBS_DIR} -licudata -licui18n -licuuc")
 	endif()
 endif()
 
 if(LIBXML2_WITH_LZMA)
 	target_link_libraries(LibXml2 PRIVATE LibLZMA::LibLZMA)
-	set(LZMA_LIBS "-llzma")
+	set(LZMA_LIBS_DIR "${LIBLZMA_INCLUDE_DIRS}")
+	STRING(REGEX REPLACE "include" "lib" LZMA_LIBS_DIR ${LZMA_LIBS_DIR})
+	set(LZMA_LIBS "-L${LZMA_LIBS_DIR} -llzma")
 endif()
 
 if(LIBXML2_WITH_THREADS)
@@ -411,7 +415,9 @@ endif()
 
 if(LIBXML2_WITH_ZLIB)
 	target_link_libraries(LibXml2 PRIVATE ZLIB::ZLIB)
-	set(Z_LIBS "-lz")
+	set(Z_LIBS_DIR "${ZLIB_INCLUDE_DIRS}")
+	STRING(REGEX REPLACE "include" "lib" Z_LIBS_DIR ${Z_LIBS_DIR})
+	set(Z_LIBS "-L${Z_LIBS_DIR} -lz")
 endif()
 
 set_target_properties(
