FindXML2.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # - Find XML2 library
  2. # Find the native XML2 includes and library
  3. # This module defines
  4. # XML2_INCLUDE_DIRS, where to find xml2.h, Set when
  5. # XML2_INCLUDE_DIR is found.
  6. # XML2_LIBRARIES, libraries to link against to use XML2.
  7. # XML2_ROOT_DIR, The base directory to search for XML2.
  8. # This can also be an environment variable.
  9. # XML2_FOUND, If false, do not try to use XML2.
  10. #
  11. # also defined, but not for general use are
  12. # XML2_LIBRARY, where to find the XML2 library.
  13. #=============================================================================
  14. # Copyright 2011 Blender Foundation.
  15. #
  16. # Distributed under the OSI-approved BSD License (the "License");
  17. # see accompanying file Copyright.txt for details.
  18. #
  19. # This software is distributed WITHOUT ANY WARRANTY; without even the
  20. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. # See the License for more information.
  22. #=============================================================================
  23. # If XML2_ROOT_DIR was defined in the environment, use it.
  24. IF(NOT XML2_ROOT_DIR AND NOT $ENV{XML2_ROOT_DIR} STREQUAL "")
  25. SET(XML2_ROOT_DIR $ENV{XML2_ROOT_DIR})
  26. ENDIF()
  27. SET(_xml2_SEARCH_DIRS
  28. ${XML2_ROOT_DIR}
  29. /usr/local
  30. /sw # Fink
  31. /opt/local # DarwinPorts
  32. )
  33. FIND_PATH(XML2_INCLUDE_DIR libxml2/libxml/xpath.h
  34. HINTS
  35. ${_xml2_SEARCH_DIRS}
  36. PATH_SUFFIXES
  37. include
  38. )
  39. FIND_LIBRARY(XML2_LIBRARY
  40. NAMES
  41. xml2
  42. HINTS
  43. ${_xml2_SEARCH_DIRS}
  44. PATH_SUFFIXES
  45. lib64 lib
  46. )
  47. # handle the QUIETLY and REQUIRED arguments and set XML2_FOUND to TRUE if
  48. # all listed variables are TRUE
  49. INCLUDE(FindPackageHandleStandardArgs)
  50. FIND_PACKAGE_HANDLE_STANDARD_ARGS(XML2 DEFAULT_MSG
  51. XML2_LIBRARY XML2_INCLUDE_DIR)
  52. IF(XML2_FOUND)
  53. SET(XML2_LIBRARIES ${XML2_LIBRARY})
  54. SET(XML2_INCLUDE_DIRS ${XML2_INCLUDE_DIR})
  55. ENDIF(XML2_FOUND)
  56. MARK_AS_ADVANCED(
  57. XML2_INCLUDE_DIR
  58. XML2_LIBRARY
  59. )