summaryrefslogtreecommitdiffstats
path: root/Modules/FindZLIB.cmake
diff options
context:
space:
mode:
authorPhilipp Möller <bootsarehax@gmail.com>2014-06-10 08:54:24 (GMT)
committerBrad King <brad.king@kitware.com>2014-06-23 15:09:25 (GMT)
commit5a7ff42100dfec3e9b84f531153842198f59cd2e (patch)
tree67ba51e718f55494e02f705c837b2f42af7cc691 /Modules/FindZLIB.cmake
parent0474aa4a78d74f971f6be5d3c4209c46bd6e02e9 (diff)
downloadCMake-5a7ff42100dfec3e9b84f531153842198f59cd2e.zip
CMake-5a7ff42100dfec3e9b84f531153842198f59cd2e.tar.gz
CMake-5a7ff42100dfec3e9b84f531153842198f59cd2e.tar.bz2
FindZLIB: Add imported target and documentation
Diffstat (limited to 'Modules/FindZLIB.cmake')
-rw-r--r--Modules/FindZLIB.cmake31
1 files changed, 23 insertions, 8 deletions
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 8cc382c..d4a27d5 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -2,9 +2,18 @@
# 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_FOUND - True if zlib found.
#
-#
-#
# ::
#
# 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_TWEAK - The tweak version of zlib
#
-#
+# Backward Compatibility
+# ^^^^^^^^^^^^^^^^^^^^^^
#
# The following variable are provided for backward compatibility
#
@@ -32,9 +40,10 @@
# ZLIB_MINOR_VERSION - The minor version of zlib
# ZLIB_PATCH_VERSION - The patch version of zlib
#
+# Hints
+# ^^^^^
#
-#
-# An includer may set ZLIB_ROOT to a zlib installation root to tell this
+# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this
# module where to look.
#=============================================================================
@@ -104,5 +113,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D
if(ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
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()