FindHDF4.cmake 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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_path(HDF4_INCLUDE_DIR hdf.h PATH_SUFFIXES hdf)
  7. find_library(MFHDF_LIB NAMES mfhdf mfhdfalt)
  8. find_library(DF_LIB NAMES df dfalt)
  9. # dependencies for the static library version of hdf4
  10. find_package(JPEG)
  11. find_package(ZLIB)
  12. set(HDF4_INCLUDE_DIRS ${HDF4_INCLUDE_DIR})
  13. set(HDF4_LIBRARIES
  14. ${MFHDF_LIB}
  15. ${DF_LIB}
  16. ${JPEG_LIBRARIES}
  17. ${ZLIB_LIBRARIES}
  18. )
  19. include(FindPackageHandleStandardArgs)
  20. find_package_handle_standard_args(HDF4
  21. FOUND_VAR HDF4_FOUND
  22. REQUIRED_VARS MFHDF_LIB DF_LIB HDF4_INCLUDE_DIR JPEG_LIBRARIES ZLIB_LIBRARIES)
  23. if(HDF4_FOUND)
  24. message(-- " HDF4 include path: ${HDF4_INCLUDE_DIRS}")
  25. message(-- " HDF4 libs: ${HDF4_LIBRARIES}")
  26. else()
  27. message(WARNING "HDF4 not found")
  28. endif()
  29. mark_as_advanced(HDF4_INCLUDE_DIR MFHDF_LIB DF_LIB)