summaryrefslogtreecommitdiff
path: root/cmake/modules/FindLibXML.cmake
blob: 891a8004f9545ef26bea46450063a7161115b7a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#
# SPDX-FileCopyrightText: Milan Crha <mcrha@redhat.com>
# SPDX-License-Identifier: BSD-3-Clause
#
# - try to find libxml
# Once done this will define
#
#  LIBXML_FOUND - system has libxml 2.0
#  LIBXML_CFLAGS
#  LIBXML_LIBRARIES

find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
  set(_libxml_version_cmp)
  if(DEFINED LibXML_FIND_VERSION)
    set(_libxml_version_cmp ${LibXML_FIND_VERSION})
    set(_libxml_version_cmp ">=${_libxml_version_cmp}")
  endif()
  pkg_check_modules(_pc_libxml libxml-2.0${_libxml_version_cmp})
  if(_pc_libxml_FOUND)
    set(LIBXML_FOUND TRUE)
    set(LIBXML_CFLAGS "${_pc_libxml_CFLAGS}")
    set(LIBXML_LIBRARIES "${_pc_libxml_LIBRARIES}")
  endif()
endif()

mark_as_advanced(
  LIBXML_CFLAGS
  LIBXML_LIBRARIES
)