FindOpenSlide.cmake 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # A CMake find module for the OpenSlide microscopy file reader library.
  2. #
  3. # http://openslide.org
  4. #
  5. # Once done, this module will define
  6. # OPENSLIDE_FOUND - system has OpenSlide
  7. # OPENSLIDE_INCLUDE_DIRS - the OpenSlide include directory
  8. # OPENSLIDE_LIBRARIES - link to these to use OpenSlide
  9. # OpenSlide::OpenSlide - imported target
  10. # Look for the header.
  11. find_path(OPENSLIDE_INCLUDE_DIR
  12. NAMES
  13. openslide/openslide.h
  14. PATHS
  15. /usr/local/include
  16. /usr/include)
  17. mark_as_advanced( OPENSLIDE_INCLUDE_DIR )
  18. # Look for the library.
  19. find_library( OPENSLIDE_LIBRARY NAMES openslide )
  20. mark_as_advanced( OPENSLIDE_LIBRARY )
  21. # Handle the QUIETLY and REQUIRED arguments and set OPENSLIDE_FOUND true if all
  22. # the listed variables are TRUE.
  23. find_package( PackageHandleStandardArgs )
  24. FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSlide DEFAULT_MSG OPENSLIDE_LIBRARY OPENSLIDE_INCLUDE_DIR )
  25. if( OPENSLIDE_FOUND )
  26. set( OPENSLIDE_LIBRARIES ${OPENSLIDE_LIBRARY} )
  27. set( OPENSLIDE_INCLUDE_DIRS ${OPENSLIDE_INCLUDE_DIR} )
  28. add_library(OpenSlide::OpenSlide UNKNOWN IMPORTED)
  29. set_target_properties(OpenSlide::OpenSlide PROPERTIES
  30. IMPORTED_LOCATION "${OPENSLIDE_LIBRARY}"
  31. INTERFACE_INCLUDE_DIRECTORIES "${OPENSLIDE_INCLUDE_DIR}")
  32. endif()