FindZLIB: Add imported target and documentation

This commit is contained in:
Philipp Möller 2014-06-10 10:54:24 +02:00 committed by Brad King
parent 0474aa4a78
commit 5a7ff42100
1 changed files with 23 additions and 8 deletions

View File

@ -2,9 +2,18 @@
# FindZLIB # FindZLIB
# -------- # --------
# #
# Find zlib # Find the native ZLIB includes and library.
# #
# Find the native ZLIB includes and library. Once done this will define # IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if
# ZLIB has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
# #
# :: # ::
# #
@ -12,8 +21,6 @@
# ZLIB_LIBRARIES - List of libraries when using zlib. # ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found. # ZLIB_FOUND - True if zlib found.
# #
#
#
# :: # ::
# #
# ZLIB_VERSION_STRING - The version of zlib found (x.y.z) # ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
@ -22,7 +29,8 @@
# ZLIB_VERSION_PATCH - The patch version of zlib # ZLIB_VERSION_PATCH - The patch version of zlib
# ZLIB_VERSION_TWEAK - The tweak version of zlib # ZLIB_VERSION_TWEAK - The tweak version of zlib
# #
# # Backward Compatibility
# ^^^^^^^^^^^^^^^^^^^^^^
# #
# The following variable are provided for backward compatibility # The following variable are provided for backward compatibility
# #
@ -32,9 +40,10 @@
# ZLIB_MINOR_VERSION - The minor version of zlib # ZLIB_MINOR_VERSION - The minor version of zlib
# ZLIB_PATCH_VERSION - The patch version of zlib # ZLIB_PATCH_VERSION - The patch version of zlib
# #
# Hints
# ^^^^^
# #
# # A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this
# An includer may set ZLIB_ROOT to a zlib installation root to tell this
# module where to look. # module where to look.
#============================================================================= #=============================================================================
@ -104,5 +113,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D
if(ZLIB_FOUND) if(ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
endif()
if(NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB UNKNOWN IMPORTED)
set_target_properties(ZLIB::ZLIB PROPERTIES
IMPORTED_LOCATION "${ZLIB_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
endif()
endif()