FindPugiXML.cmake 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # - Find PugiXML library
  2. # Find the native PugiXML includes and library
  3. # This module defines
  4. # PUGIXML_INCLUDE_DIRS, where to find pugixml.hpp, Set when
  5. # PugiXML is found.
  6. # PUGIXML_LIBRARIES, libraries to link against to use PugiiXML.
  7. # PUGIXML_ROOT_DIR, The base directory to search for PugiXML.
  8. # This can also be an environment variable.
  9. # PUGIXML_FOUND, If false, do not try to use PugiXML.
  10. #
  11. # also defined, but not for general use are
  12. # PUGIXML_LIBRARY, where to find the PugiXML library.
  13. #=============================================================================
  14. # Copyright 2014 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 PUGIXML_ROOT_DIR was defined in the environment, use it.
  24. IF(NOT PUGIXML_ROOT_DIR AND NOT $ENV{PUGIXML_ROOT_DIR} STREQUAL "")
  25. SET(PUGIXML_ROOT_DIR $ENV{PUGIXML_ROOT_DIR})
  26. ENDIF()
  27. SET(_pugixml_SEARCH_DIRS
  28. ${PUGIXML_ROOT_DIR}
  29. /usr/local
  30. /sw # Fink
  31. /opt/local # DarwinPorts
  32. /opt/lib/oiio
  33. )
  34. FIND_PATH(PUGIXML_INCLUDE_DIR
  35. NAMES
  36. pugixml.hpp
  37. HINTS
  38. ${_pugixml_SEARCH_DIRS}
  39. PATH_SUFFIXES
  40. include
  41. )
  42. FIND_LIBRARY(PUGIXML_LIBRARY
  43. NAMES
  44. pugixml
  45. HINTS
  46. ${_pugixml_SEARCH_DIRS}
  47. PATH_SUFFIXES
  48. lib64 lib
  49. )
  50. # handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
  51. # all listed variables are TRUE
  52. INCLUDE(FindPackageHandleStandardArgs)
  53. FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG
  54. PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
  55. IF(PUGIXML_FOUND)
  56. SET(PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
  57. SET(PUGIXML_INCLUDE_DIRS ${PUGIXML_INCLUDE_DIR})
  58. ELSE()
  59. SET(PUGIXML_PUGIXML_FOUND FALSE)
  60. ENDIF()
  61. MARK_AS_ADVANCED(
  62. PUGIXML_INCLUDE_DIR
  63. PUGIXML_LIBRARY
  64. )