FindHDF5.cmake 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # - Find HDF5 library
  2. # Find the native HDF5 includes and libraries
  3. # This module defines
  4. # HDF5_INCLUDE_DIRS, where to find hdf5.h, Set when HDF5_INCLUDE_DIR is found.
  5. # HDF5_LIBRARIES, libraries to link against to use HDF5.
  6. # HDF5_ROOT_DIR, The base directory to search for HDF5.
  7. # This can also be an environment variable.
  8. # HDF5_FOUND, If false, do not try to use HDF5.
  9. #
  10. #=============================================================================
  11. # Copyright 2016 Blender Foundation.
  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. # If HDF5_ROOT_DIR was defined in the environment, use it.
  21. IF(NOT HDF5_ROOT_DIR AND NOT $ENV{HDF5_ROOT_DIR} STREQUAL "")
  22. SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR})
  23. ENDIF()
  24. SET(_hdf5_SEARCH_DIRS
  25. ${HDF5_ROOT_DIR}
  26. /usr/local
  27. /sw # Fink
  28. /opt/local # DarwinPorts
  29. /opt/csw # Blastwave
  30. /opt/lib/hdf5
  31. )
  32. FIND_LIBRARY(HDF5_LIBRARY
  33. NAMES
  34. hdf5
  35. HINTS
  36. ${_hdf5_SEARCH_DIRS}
  37. PATH_SUFFIXES
  38. lib64 lib
  39. )
  40. FIND_PATH(HDF5_INCLUDE_DIR
  41. NAMES
  42. hdf5.h
  43. HINTS
  44. ${_hdf5_SEARCH_DIRS}
  45. PATH_SUFFIXES
  46. include
  47. )
  48. # handle the QUIETLY and REQUIRED arguments and set HDF5_FOUND to TRUE if
  49. # all listed variables are TRUE
  50. INCLUDE(FindPackageHandleStandardArgs)
  51. FIND_PACKAGE_HANDLE_STANDARD_ARGS(HDF5 DEFAULT_MSG HDF5_LIBRARY HDF5_INCLUDE_DIR)
  52. IF(HDF5_FOUND)
  53. SET(HDF5_LIBRARIES ${HDF5_LIBRARY})
  54. SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
  55. ENDIF(HDF5_FOUND)
  56. MARK_AS_ADVANCED(
  57. HDF5_INCLUDE_DIR
  58. HDF5_LIBRARY
  59. )
  60. UNSET(_hdf5_SEARCH_DIRS)