FindTIFF.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # - Find TIFF library
  2. # Find the native TIFF includes and library
  3. # This module defines
  4. # TIFF_INCLUDE_DIR, where to find tiff.h, etc.
  5. # TIFF_LIBRARIES, libraries to link against to use TIFF.
  6. # TIFF_FOUND, If false, do not try to use TIFF.
  7. # also defined, but not for general use are
  8. # TIFF_LIBRARY, where to find the TIFF library.
  9. #=============================================================================
  10. # Copyright 2002-2009 Kitware, Inc.
  11. #
  12. # Distributed under the OSI-approved BSD License (the "License");
  13. # see accompanying file Copyright.txt for details.
  14. #
  15. # This software is distributed WITHOUT ANY WARRANTY; without even the
  16. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. # See the License for more information.
  18. #=============================================================================
  19. # (To distribute this file outside of CMake, substitute the full
  20. # License text for the above reference.)
  21. find_path(TIFF_INCLUDE_DIR tiff.h)
  22. set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3)
  23. find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES} )
  24. if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h")
  25. file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str
  26. REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
  27. string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*"
  28. "\\1" TIFF_VERSION_STRING "${tiff_version_str}")
  29. unset(tiff_version_str)
  30. endif()
  31. # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
  32. # all listed variables are TRUE
  33. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  34. FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
  35. REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR
  36. VERSION_VAR TIFF_VERSION_STRING)
  37. if(TIFF_FOUND)
  38. set( TIFF_LIBRARIES ${TIFF_LIBRARY} )
  39. endif()
  40. mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY)