2 # Find the native TIFF includes and library
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.
10 #=============================================================================
11 # Copyright 2002-2009 Kitware, Inc.
13 # Distributed under the OSI-approved BSD License (the "License");
14 # see accompanying file Copyright.txt for details.
16 # This software is distributed WITHOUT ANY WARRANTY; without even the
17 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 # See the License for more information.
19 #=============================================================================
20 # (To distribute this file outside of CMake, substitute the full
21 # License text for the above reference.)
23 find_path(TIFF_INCLUDE_DIR tiff.h)
25 set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3)
26 find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES} )
28 if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h")
29 file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str
30 REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
32 string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*"
33 "\\1" TIFF_VERSION_STRING "${tiff_version_str}")
34 unset(tiff_version_str)
37 # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
38 # all listed variables are TRUE
39 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
40 FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
41 REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR
42 VERSION_VAR TIFF_VERSION_STRING)
45 set( TIFF_LIBRARIES ${TIFF_LIBRARY} )
48 mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY)