Cmake libxml compatibility

This commit is contained in:
Thomas Krijnen
2025-09-10 10:36:08 +02:00
parent f86e5abb85
commit ee632b7c37
+11 -8
View File
@@ -448,16 +448,19 @@ if(NOT MINIMAL_BUILD)
if(NOT LibXml2_FOUND)
# Fallback to CMake's builtin FindLibXml2 module (works on Ubuntu)
find_package(LibXml2 REQUIRED)
else()
message(STATUS "Found LibXml2 config: ${LibXml2_DIR}")
endif()
message(STATUS "Found LibXml2 config: ${LibXml2_DIR}")
get_target_property(LIBXML2_INCLUDE_DIR LibXml2::LibXml2 INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(_libxml2_debug LibXml2::LibXml2 IMPORTED_LOCATION_DEBUG)
get_target_property(_libxml2_release LibXml2::LibXml2 IMPORTED_LOCATION_RELEASE)
set(LIBXML2_LIBRARIES
optimized ${_libxml2_release}
debug ${_libxml2_debug}
)
if(TARGET LibXml2::LibXml2)
# Config mode already gives us the target
set(LIBXML2_LIBRARIES LibXml2::LibXml2)
get_target_property(LIBXML2_INCLUDE_DIR LibXml2::LibXml2 INTERFACE_INCLUDE_DIRECTORIES)
else()
# Module mode (Ubuntu)
set(LIBXML2_LIBRARIES ${LibXml2_LIBRARIES})
set(LIBXML2_INCLUDE_DIR ${LibXml2_INCLUDE_DIRS})
endif()
else()
find_package(LibXml2 REQUIRED)
endif()