1 # - Try to find the LibXml2 xml processing library
2 # Once done this will define
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
10 #=============================================================================
11 # Copyright 2006-2009 Kitware, Inc.
12 # Copyright 2006 Alexander Neundorf <neundorf@kde.org>
14 # Distributed under the OSI-approved BSD License (the "License");
15 # see accompanying file Copyright.txt for details.
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.)
24 # use pkg-config to get the directories and then use these values
25 # in the FIND_PATH() and FIND_LIBRARY() calls
26 FIND_PACKAGE(PkgConfig)
27 PKG_CHECK_MODULES(PC_LIBXML libxml-2.0)
28 SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
30 FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
32 ${PC_LIBXML_INCLUDEDIR}
33 ${PC_LIBXML_INCLUDE_DIRS}
37 FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
40 ${PC_LIBXML_LIBRARY_DIRS}
43 FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
44 # for backwards compat. with KDE 4.0.x:
45 SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
47 # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
48 # all listed variables are TRUE
49 INCLUDE(FindPackageHandleStandardArgs)
50 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
52 MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)