From f86e5abb85c1a4a5f9755ab5660aad9c4aa833ee Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 10 Sep 2025 10:17:59 +0200 Subject: [PATCH] Cmake libxml compatibility --- cmake/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 397d5ca4ea..9fa99a67cb 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -442,7 +442,14 @@ if(NOT MINIMAL_BUILD) clear_wasm_sysroot() if(IFCXML_SUPPORT) if((NOT LIBXML2_INCLUDE_DIR AND NOT LIBXML2_LIBRARIES)) - find_package(LibXml2 CONFIG REQUIRED) + # First try config mode (probably works with vcpkg, Conan, macOS brew installs, but not on ubuntu 22.04?) + find_package(LibXml2 QUIET CONFIG) + + if(NOT LibXml2_FOUND) + # Fallback to CMake's builtin FindLibXml2 module (works on Ubuntu) + find_package(LibXml2 REQUIRED) + 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)