From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ismael Luceno <ismael@sourcemage.org>
Date: Mon, 31 Aug 2026 18:31:00 +0200
Subject: [PATCH] Use system pugixml

Use the system package instead of FetchContent.

Upstream-Status: Pending
Origin: Source Mage
Signed-off-by: Ismael Luceno <ismael@sourcemage.org>
---
 CMakeLists.txt |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -154,11 +154,7 @@
 set(FETCHCONTENT_BASE_DIR "${CMAKE_SOURCE_DIR}/third-party")
 
 # pugixml - XML parsing for DOCX files
-FetchContent_Declare(pugixml
-    GIT_REPOSITORY https://github.com/zeux/pugixml.git
-    GIT_TAG v${PUGIXML_VERSION}
-    SOURCE_DIR "${CMAKE_SOURCE_DIR}/third-party/pugixml"
-)
+find_package(pugixml REQUIRED)
 
 # chillout - Using local version with custom createCrashDump implementation
 
@@ -193,7 +191,6 @@
 
 # Download dependencies but don't include their CMake files
 # (we'll compile source files directly to avoid conflicts)
-FetchContent_Populate(pugixml)
 FetchContent_Populate(cpp-unicodelib)
 FetchContent_Populate(simpleini)
 FetchContent_Populate(exprtk)
@@ -350,7 +347,6 @@
 
     # Third-party sources that need to be compiled directly
     # (libraries without CMake targets or header-only libs)
-    ${pugixml_SOURCE_DIR}/src/pugixml.cpp
     src/third-party/chillout/src/chillout/chillout.cpp
     src/third-party/chillout/src/chillout/common/common.cpp
     ${kubazip_SOURCE_DIR}/src/zip.c
@@ -397,7 +393,6 @@
 
 target_include_directories(WordTsar PRIVATE
     src/third-party/chillout/src
-    ${pugixml_SOURCE_DIR}/src
     ${cpp-unicodelib_SOURCE_DIR}
     ${simpleini_SOURCE_DIR}
     ${exprtk_SOURCE_DIR}
@@ -408,6 +403,7 @@
     Qt::Core
     Qt::Gui
     Qt::PrintSupport
+    pugixml::pugixml
 )
 
 if (WIN32)
