FindTIFF: Update documentation

- Added examples section.
- Synced descriptions with other similar find modules.
- Added TIFF_VERSION_STRING to the result variables (available since the
  early introduction of this module).
- Described imported targets in more details.
- Refactored components section to make the usage clearer.
This commit is contained in:
Peter Kokot
2025-04-05 22:40:50 +02:00
parent e2e5303fe2
commit 257d1f446a

View File

@@ -5,64 +5,107 @@
FindTIFF
--------
Find the TIFF library (``libtiff``, https://libtiff.gitlab.io/libtiff/).
Finds the `TIFF library <https://libtiff.gitlab.io/libtiff/>`_ (``libtiff``).
This module also takes into account the upstream TIFF library's exported CMake
package configuration, if available.
Optional COMPONENTS
^^^^^^^^^^^^^^^^^^^
Components
^^^^^^^^^^
This module supports the optional component `CXX`, for use with the COMPONENTS
argument of the :command:`find_package` command. This component has an associated
imported target, as described below.
This module supports the following components:
``CXX``
.. versionadded:: 3.19
Optional component that ensures that the C++ wrapper library (``libtiffxx``)
is found.
Components can be specified using the standard syntax:
.. code-block:: cmake
find_package(TIFF [COMPONENTS <components>...])
Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.5
This module defines the following :prop_tgt:`IMPORTED` targets:
This module provides the following :ref:`Imported Targets`:
``TIFF::TIFF``
The TIFF library, if found.
.. versionadded:: 3.5
Target encapsulating the TIFF library usage requirements, available only if
the TIFF is found.
``TIFF::CXX``
.. versionadded:: 3.19
The C++ wrapper libtiffxx, if requested by the `COMPONENTS CXX` option,
if the compiler is not MSVC (which includes the C++ wrapper in libtiff),
and if found.
Target encapsulating the usage requirements for the the C++ wrapper library
``libtiffxx``, available only if TIFF is found. This target provides CXX
usage requirements only if the compiler is not MSVC. It also has the
``TIFF::TIFF`` target linked in to simplify its usage.
Result variables
Result Variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project:
This module defines the following variables:
``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
Boolean indicating whether the TIFF is found.
Cache variables
``TIFF_VERSION_STRING``
The version of the TIFF library found.
``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_RELEASE``
the path to the TIFF library for release configurations
``TIFF_LIBRARY_DEBUG``
the path to the TIFF library for debug configurations
``TIFFXX_LIBRARY_RELEASE``
the path to the TIFFXX library for release configurations
``TIFFXX_LIBRARY_DEBUG``
the path to the TIFFXX library for debug configurations
The directory containing the TIFF headers.
.. versionadded:: 3.4
Debug and Release variants are found separately.
``TIFF_LIBRARY_RELEASE``
.. versionadded:: 3.4
The path to the TIFF library for release configurations.
``TIFF_LIBRARY_DEBUG``
.. versionadded:: 3.4
The path to the TIFF library for debug configurations.
``TIFFXX_LIBRARY_RELEASE``
.. versionadded:: 3.19
The path to the TIFFXX library for release configurations.
``TIFFXX_LIBRARY_DEBUG``
.. versionadded:: 3.19
The path to the TIFFXX library for debug configurations.
Examples
^^^^^^^^
Finding TIFF library and linking it to a project target:
.. code-block:: cmake
find_package(TIFF)
target_link_libraries(project_target PRIVATE TIFF::TIFF)
Finding TIFF and TIFFXX libraries by specifying the ``CXX`` component:
.. code-block:: cmake
find_package(TIFF COMPONENTS CXX)
target_link_libraries(project_target PRIVATE TIFF::CXX)
#]=======================================================================]
cmake_policy(PUSH)