FindHDF4.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. set(HDF4_INCLUDE_DIRS
  10. $<TARGET_PROPERTY:hdf4::mfhdf-static,INTERFACE_INCLUDE_DIRECTORIES>
  11. $<TARGET_PROPERTY:hdf4::hdf-static,INTERFACE_INCLUDE_DIRECTORIES>)
  12. else ()
  13. find_path(HDF4_INCLUDE_DIRS hdf.h PATH_SUFFIXES hdf)
  14. find_library(MFHDF_LIB NAMES mfhdf mfhdfalt)
  15. find_library(HDF_LIB NAMES df dfalt hdf)
  16. # dependencies for the static library version of hdf4
  17. find_package(JPEG)
  18. find_package(ZLIB)
  19. if (NOT (MFHDF_LIB AND HDF_LIB AND JPEG_LIBRARIES AND ZLIB_LIBRARIES))
  20. set (HDF4_LIBRARIES HDF4_LIBRARIES-NOTFOUND)
  21. else()
  22. set(HDF4_LIBRARIES
  23. ${MFHDF_LIB}
  24. ${HDF_LIB}
  25. ${JPEG_LIBRARIES}
  26. ${ZLIB_LIBRARIES}
  27. )
  28. endif ()
  29. endif ()
  30. include(FindPackageHandleStandardArgs)
  31. find_package_handle_standard_args(HDF4
  32. FOUND_VAR HDF4_FOUND
  33. REQUIRED_VARS HDF4_INCLUDE_DIRS HDF4_LIBRARIES)
  34. if (HDF4_FOUND)
  35. message(-- " HDF4 include path: ${HDF4_INCLUDE_DIRS}")
  36. message(-- " HDF4 libs: ${HDF4_LIBRARIES}")
  37. else ()
  38. message(WARNING "HDF4 not found")
  39. endif ()
  40. mark_as_advanced(HDF4_INCLUDE_DIR HDF4_LIBRARIES)