Debian Codegraph @

cmake/FindLibXml2.cmake

raw
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 #
9 # Copyright (c) 2006, Alexander Neundorf <[email protected]>
10 # This code is available under the BSD license, see licenses/BSD for details.
11
12 # Copyright (c) 2006, Alexander Neundorf, <[email protected]>
13 #
14 # Redistribution and use is allowed according to the terms of the BSD license.
15 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
16
17
18 IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
19 # in cache already
20 SET(LibXml2_FIND_QUIETLY TRUE)
21 ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
22
23 IF (NOT WIN32)
24 # use pkg-config to get the directories and then use these values
25 # in the FIND_PATH() and FIND_LIBRARY() calls
26 INCLUDE(UsePkgConfig)
27 PKGCONFIG(libxml-2.0 _LibXml2IncDir _LibXml2LinkDir _LibXml2LinkFlags _LibXml2Cflags)
28 SET(LIBXML2_DEFINITIONS ${_LibXml2Cflags})
29 ENDIF (NOT WIN32)
30
31 FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h
32 PATHS
33 ${_LibXml2IncDir}
34 PATH_SUFFIXES libxml2
35 )
36
37 FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
38 PATHS
39 ${_LibXml2LinkDir}
40 )
41
42 IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
43 SET(LIBXML2_FOUND TRUE)
44 ELSE (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
45 SET(LIBXML2_FOUND FALSE)
46 ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
47
48 IF (LIBXML2_FOUND)
49 IF (NOT LibXml2_FIND_QUIETLY)
50 MESSAGE(STATUS "Found LibXml2: ${LIBXML2_LIBRARIES}")
51 ENDIF (NOT LibXml2_FIND_QUIETLY)
52 ELSE (LIBXML2_FOUND)
53 IF (LibXml2_FIND_REQUIRED)
54 MESSAGE(SEND_ERROR "Could NOT find LibXml2")
55 ENDIF (LibXml2_FIND_REQUIRED)
56 ENDIF (LIBXML2_FOUND)
57
58 MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES)
59