blob: e18dc2e921b8f49d103cf3ce9547ee0885d50dd7 [file] [log] [blame]
Brian Waters13d96012017-12-08 16:53:31 -06001# - Try to find the LibXml2 xml processing library
2# Once done this will define
3#
4# LIBXML2_FOUND - System has LibXml2
5# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
6# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
7# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
8# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
9
10#=============================================================================
11# Copyright 2006-2009 Kitware, Inc.
12# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
13#
14# Distributed under the OSI-approved BSD License (the "License");
15# see accompanying file Copyright.txt for details.
16#
17# This software is distributed WITHOUT ANY WARRANTY; without even the
18# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19# See the License for more information.
20#=============================================================================
21# (To distributed this file outside of CMake, substitute the full
22# License text for the above reference.)
23
24# use pkg-config to get the directories and then use these values
25# in the FIND_PATH() and FIND_LIBRARY() calls
26FIND_PACKAGE(PkgConfig)
27PKG_CHECK_MODULES(PC_LIBXML libxml-2.0)
28SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
29
30FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
31 HINTS
32 ${PC_LIBXML_INCLUDEDIR}
33 ${PC_LIBXML_INCLUDE_DIRS}
34 PATH_SUFFIXES libxml2
35 )
36
37FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
38 HINTS
39 ${PC_LIBXML_LIBDIR}
40 ${PC_LIBXML_LIBRARY_DIRS}
41 )
42
43FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
44# for backwards compat. with KDE 4.0.x:
45SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
46
47# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
48# all listed variables are TRUE
49INCLUDE(FindPackageHandleStandardArgs)
50FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
51
52MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)
53