# HG changeset patch
# User Nick Wellnhofer <wellnhofer@aevum.de>
# Date 1663844353 -7200
#      Thu Sep 22 12:59:13 2022 +0200
# Node ID 33bc59e03d4cf89c648983d2f04874431268c710
# Parent  eb744d99db4e38d340056327865d0d0a289c9e5e
cmake: Fix build with libxslt and libxml2 as subprojects

Fixes https://gitlab.gnome.org/GNOME/libxml2/-/issues/416

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,9 @@
 include(CMakePackageConfigHelpers)
 include(GNUInstallDirs)
 
-find_package(LibXml2 CONFIG REQUIRED)
+if(NOT TARGET LibXml2)
+	find_package(LibXml2 CONFIG REQUIRED)
+endif()
 
 option(BUILD_SHARED_LIBS "Build shared libraries" ON)
 option(LIBXSLT_WITH_DEBUGGER "Add the debugging support" ON)