Link against ZLIB when zlib is used

Signed-off-by: Paul Bakker <p.j.bakker@polarssl.org>
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index baaf822..c4060d1 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -82,6 +82,10 @@
 
 target_link_libraries(polarssl ${libs})
 
+if(ZLIB_FOUND)
+target_link_libraries(polarssl ${ZLIB_LIBRARIES})
+endif(ZLIB_FOUND)
+
 install(TARGETS polarssl
         DESTINATION ${LIB_INSTALL_DIR}
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)