FindLibXml2.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # - 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. # Copyright 2006-2009 Kitware, Inc.
  11. # Copyright 2006 Alexander Neundorf <[email protected]>
  12. #
  13. # Distributed under the OSI-approved BSD License (the "License");
  14. # see accompanying file Copyright.txt for details.
  15. #
  16. # This software is distributed WITHOUT ANY WARRANTY; without even the
  17. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. # See the License for more information.
  19. #=============================================================================
  20. # (To distribute this file outside of CMake, substitute the full
  21. # License text for the above reference.)
  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 QUIET)
  26. SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
  27. FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
  28. HINTS
  29. ${PC_LIBXML_INCLUDEDIR}
  30. ${PC_LIBXML_INCLUDE_DIRS}
  31. PATH_SUFFIXES libxml2
  32. )
  33. FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
  34. HINTS
  35. ${PC_LIBXML_LIBDIR}
  36. ${PC_LIBXML_LIBRARY_DIRS}
  37. )
  38. FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
  39. # for backwards compat. with KDE 4.0.x:
  40. SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
  41. # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
  42. # all listed variables are TRUE
  43. INCLUDE(FindPackageHandleStandardArgs)
  44. FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
  45. MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)