summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindLibXml2.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindLibXml2.cmake')
-rw-r--r--cmake/modules/FindLibXml2.cmake57
1 files changed, 57 insertions, 0 deletions
diff --git a/cmake/modules/FindLibXml2.cmake b/cmake/modules/FindLibXml2.cmake
new file mode 100644
index 0000000..8d3c77e
--- /dev/null
+++ b/cmake/modules/FindLibXml2.cmake
@@ -0,0 +1,57 @@
1# - Try to find LibXml2
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# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
11#
12# Redistribution and use is allowed according to the terms of the BSD license.
13# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14
15
16IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
17 # in cache already
18 SET(LibXml2_FIND_QUIETLY TRUE)
19ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
20
21IF (NOT WIN32)
22 # use pkg-config to get the directories and then use these values
23 # in the FIND_PATH() and FIND_LIBRARY() calls
24 FIND_PACKAGE(PkgConfig)
25 PKG_CHECK_MODULES(PC_LIBXML libxml-2.0)
26 SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
27ENDIF (NOT WIN32)
28
29FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h
30 HINTS
31 ${PC_LIBXML_INCLUDEDIR}
32 ${PC_LIBXML_INCLUDE_DIRS}
33 PATH_SUFFIXES libxml2
34 )
35
36FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
37 HINTS
38 ${PC_LIBXML_LIBDIR}
39 ${PC_LIBXML_LIBRARY_DIRS}
40 )
41
42FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
43# for backwards compat. with KDE 4.0.x:
44SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
45
46IF( NOT LIBXML2_XMLLINT_EXECUTABLE )
47 MESSAGE(STATUS "xmllint program not found. Install it if you want validate generated doc file.")
48ENDIF(NOT LIBXML2_XMLLINT_EXECUTABLE )
49
50
51INCLUDE(FindPackageHandleStandardArgs)
52
53# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
54# all listed variables are TRUE
55FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
56
57MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)