2013-10-15 19:17:36 +04:00
|
|
|
#.rst:
|
|
|
|
# FindTIFF
|
|
|
|
# --------
|
|
|
|
#
|
2015-12-02 20:20:24 +03:00
|
|
|
# Find the TIFF library (libtiff).
|
2013-10-15 19:17:36 +04:00
|
|
|
#
|
2015-12-02 20:20:24 +03:00
|
|
|
# Imported targets
|
|
|
|
# ^^^^^^^^^^^^^^^^
|
2013-10-15 19:17:36 +04:00
|
|
|
#
|
2015-12-02 20:20:24 +03:00
|
|
|
# This module defines the following :prop_tgt:`IMPORTED` targets:
|
2013-10-15 19:17:36 +04:00
|
|
|
#
|
2015-12-02 20:20:24 +03:00
|
|
|
# ``TIFF::TIFF``
|
|
|
|
# The TIFF library, if found.
|
2013-10-15 19:17:36 +04:00
|
|
|
#
|
2015-12-02 20:20:24 +03:00
|
|
|
# Result variables
|
|
|
|
# ^^^^^^^^^^^^^^^^
|
2013-10-15 19:17:36 +04:00
|
|
|
#
|
2015-12-02 20:20:24 +03:00
|
|
|
# This module will set the following variables in your project:
|
2013-10-15 19:17:36 +04:00
|
|
|
#
|
2015-12-02 20:20:24 +03:00
|
|
|
# ``TIFF_FOUND``
|
|
|
|
# true if the TIFF headers and libraries were found
|
|
|
|
# ``TIFF_INCLUDE_DIR``
|
|
|
|
# the directory containing the TIFF headers
|
|
|
|
# ``TIFF_INCLUDE_DIRS``
|
|
|
|
# the directory containing the TIFF headers
|
|
|
|
# ``TIFF_LIBRARIES``
|
|
|
|
# TIFF libraries to be linked
|
|
|
|
#
|
|
|
|
# Cache variables
|
|
|
|
# ^^^^^^^^^^^^^^^
|
|
|
|
#
|
|
|
|
# The following cache variables may also be set:
|
|
|
|
#
|
|
|
|
# ``TIFF_INCLUDE_DIR``
|
|
|
|
# the directory containing the TIFF headers
|
|
|
|
# ``TIFF_LIBRARY``
|
|
|
|
# the path to the TIFF library
|
2002-09-02 20:58:48 +04:00
|
|
|
|
2009-09-28 19:45:50 +04:00
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2002-2009 Kitware, Inc.
|
2015-12-02 20:20:24 +03:00
|
|
|
# Copyright 2015 University of Dundee
|
2009-09-28 19:45:50 +04:00
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:45:50 +04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_path(TIFF_INCLUDE_DIR tiff.h)
|
2002-09-02 20:58:48 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3)
|
2015-08-07 16:51:42 +03:00
|
|
|
foreach(name ${TIFF_NAMES})
|
|
|
|
list(APPEND TIFF_NAMES_DEBUG "${name}d")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(NOT TIFF_LIBRARY)
|
|
|
|
find_library(TIFF_LIBRARY_RELEASE NAMES ${TIFF_NAMES})
|
|
|
|
find_library(TIFF_LIBRARY_DEBUG NAMES ${TIFF_NAMES_DEBUG})
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
|
|
|
select_library_configurations(TIFF)
|
|
|
|
mark_as_advanced(TIFF_LIBRARY_RELEASE TIFF_LIBRARY_DEBUG)
|
|
|
|
endif()
|
|
|
|
unset(TIFF_NAMES)
|
|
|
|
unset(TIFF_NAMES_DEBUG)
|
2002-09-02 20:58:48 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h")
|
|
|
|
file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str
|
2012-01-26 21:19:06 +04:00
|
|
|
REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*"
|
2012-01-26 21:19:06 +04:00
|
|
|
"\\1" TIFF_VERSION_STRING "${tiff_version_str}")
|
2012-08-13 21:47:32 +04:00
|
|
|
unset(tiff_version_str)
|
|
|
|
endif()
|
2012-01-26 21:19:06 +04:00
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
|
2007-07-18 21:56:45 +04:00
|
|
|
# all listed variables are TRUE
|
2012-08-13 21:47:32 +04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2012-01-26 21:19:06 +04:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
|
|
|
|
REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR
|
|
|
|
VERSION_VAR TIFF_VERSION_STRING)
|
2002-09-02 20:58:48 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(TIFF_FOUND)
|
2015-12-02 20:20:24 +03:00
|
|
|
set(TIFF_LIBRARIES ${TIFF_LIBRARY})
|
|
|
|
set(TIFF_INCLUDE_DIRS "${TIFF_INCLUDE_DIR}")
|
|
|
|
|
|
|
|
if(NOT TARGET TIFF::TIFF)
|
|
|
|
add_library(TIFF::TIFF UNKNOWN IMPORTED)
|
|
|
|
if(TIFF_INCLUDE_DIRS)
|
|
|
|
set_target_properties(TIFF::TIFF PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${TIFF_INCLUDE_DIRS}")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${TIFF_LIBRARY}")
|
|
|
|
set_target_properties(TIFF::TIFF PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
|
|
IMPORTED_LOCATION "${TIFF_LIBRARY}")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${TIFF_LIBRARY_DEBUG}")
|
|
|
|
set_property(TARGET TIFF::TIFF APPEND PROPERTY
|
|
|
|
IMPORTED_CONFIGURATIONS DEBUG)
|
|
|
|
set_target_properties(TIFF::TIFF PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
|
|
|
|
IMPORTED_LOCATION_DEBUG "${TIFF_LIBRARY_DEBUG}")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${TIFF_LIBRARY_RELEASE}")
|
|
|
|
set_property(TARGET TIFF::TIFF APPEND PROPERTY
|
|
|
|
IMPORTED_CONFIGURATIONS RELEASE)
|
|
|
|
set_target_properties(TIFF::TIFF PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
|
|
|
|
IMPORTED_LOCATION_RELEASE "${TIFF_LIBRARY_RELEASE}")
|
|
|
|
endif()
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2008-08-16 15:29:53 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY)
|