FindHDF4.cmake 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # - Find the HDF4 library together with dependencies...
  2. # This module defines the following variables:
  3. # HDF4_INCLUDE_DIRS - include directories for HDF4
  4. # HDF4_LIBRARIES - libraries to link against HDF4
  5. # HDF4_FOUND - true if HDF4 has been found and can be used
  6. find_package(HDF4 CONFIG QUIET)
  7. if (HDF4_FOUND)
  8. set(HDF4_LIBRARIES hdf4::mfhdf-static hdf4::hdf-static)
  9. else ()
  10. find_path(HDF4_INCLUDE_DIRS hdf.h PATH_SUFFIXES hdf)
  11. find_library(MFHDF_LIB NAMES mfhdf mfhdfalt)
  12. find_library(HDF_LIB NAMES df dfalt hdf)
  13. # dependencies for the static library version of hdf4
  14. find_package(JPEG)
  15. find_package(ZLIB)
  16. if (NOT (MFHDF_LIB AND HDF_LIB AND JPEG_LIBRARIES AND ZLIB_LIBRARIES))
  17. set (HDF4_LIBRARIES HDF4_LIBRARIES-NOTFOUND)
  18. else()
  19. set(HDF4_LIBRARIES
  20. ${MFHDF_LIB}
  21. ${HDF_LIB}
  22. ${JPEG_LIBRARIES}
  23. ${ZLIB_LIBRARIES}
  24. )
  25. endif ()
  26. endif ()
  27. include(FindPackageHandleStandardArgs)
  28. find_package_handle_standard_args(HDF4
  29. FOUND_VAR HDF4_FOUND
  30. REQUIRED_VARS HDF4_INCLUDE_DIRS HDF4_LIBRARIES)
  31. if (HDF4_FOUND)
  32. message(-- " HDF4 include path: ${HDF4_INCLUDE_DIRS}")
  33. message(-- " HDF4 libs: ${HDF4_LIBRARIES}")
  34. else ()
  35. message(WARNING "HDF4 not found")
  36. endif ()
  37. mark_as_advanced(HDF4_INCLUDE_DIR HDF4_LIBRARIES)