FindPugiXML.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/csw # Blastwave
  33. /opt/lib/oiio
  34. )
  35. FIND_PATH(PUGIXML_INCLUDE_DIR
  36. NAMES
  37. pugixml.hpp
  38. HINTS
  39. ${_pugixml_SEARCH_DIRS}
  40. PATH_SUFFIXES
  41. include
  42. )
  43. FIND_LIBRARY(PUGIXML_LIBRARY
  44. NAMES
  45. pugixml
  46. HINTS
  47. ${_pugixml_SEARCH_DIRS}
  48. PATH_SUFFIXES
  49. lib64 lib
  50. )
  51. # handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
  52. # all listed variables are TRUE
  53. INCLUDE(FindPackageHandleStandardArgs)
  54. FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG
  55. PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
  56. IF(PUGIXML_FOUND)
  57. SET(PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
  58. SET(PUGIXML_INCLUDE_DIRS ${PUGIXML_INCLUDE_DIR})
  59. ELSE()
  60. SET(PUGIXML_PUGIXML_FOUND FALSE)
  61. ENDIF()
  62. MARK_AS_ADVANCED(
  63. PUGIXML_INCLUDE_DIR
  64. PUGIXML_LIBRARY
  65. )