THRIFT-5265 add the zlib transport to c_glib
Client: c_glib
Patch: Zezeng Wang

This closes #2216
diff --git a/lib/c_glib/CMakeLists.txt b/lib/c_glib/CMakeLists.txt
index 5f0b6f5..2bee9e4 100644
--- a/lib/c_glib/CMakeLists.txt
+++ b/lib/c_glib/CMakeLists.txt
@@ -59,6 +59,17 @@
     src/thrift/c_glib/server/thrift_simple_server.c
 )
 
+set(thrift_c_glib_zlib_SOURCES
+    src/thrift/c_glib/thrift.c
+    src/thrift/c_glib/thrift_struct.c
+    src/thrift/c_glib/thrift_application_exception.c
+    src/thrift/c_glib/thrift_configuration.c
+    src/thrift/c_glib/transport/thrift_transport.c
+    src/thrift/c_glib/transport/thrift_transport_factory.c
+    src/thrift/c_glib/transport/thrift_zlib_transport.c
+    src/thrift/c_glib/transport/thrift_zlib_transport_factory.c   
+)
+
 # If OpenSSL is not found just ignore the OpenSSL stuff
 if(WITH_OPENSSL)
     list(APPEND thrift_c_glib_SOURCES
@@ -75,6 +86,14 @@
 ADD_LIBRARY_THRIFT(thrift_c_glib ${thrift_c_glib_SOURCES})
 TARGET_LINK_LIBRARIES_THRIFT(thrift_c_glib PUBLIC ${SYSLIBS})
 
+# If Zlib is not found just ignore the Zlib stuff
+if(WITH_ZLIB)
+    include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS})
+    ADD_LIBRARY_THRIFT(thrift_c_glib_zlib ${thrift_c_glib_zlib_SOURCES})
+    TARGET_LINK_LIBRARIES_THRIFT(thrift_c_glib_zlib ${SYSLIBS} ${ZLIB_LIBRARIES})
+    TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY(thrift_c_glib_zlib thrift_c_glib)
+endif()
+
 # Install the headers
 install(DIRECTORY "src/thrift" DESTINATION "${INCLUDE_INSTALL_DIR}"
     FILES_MATCHING PATTERN "*.h")