THRIFT-2423 Facebook's THeader protocol and transport for cpp
Client: C++ Library, Compiler
Patch: Dave Watson rebased by Nobuaki Sukegawa

This closes #357 and closes #677
diff --git a/lib/cpp/test/CMakeLists.txt b/lib/cpp/test/CMakeLists.txt
index 5de9fc4..033b4d2 100644
--- a/lib/cpp/test/CMakeLists.txt
+++ b/lib/cpp/test/CMakeLists.txt
@@ -21,6 +21,7 @@
 set(Boost_USE_STATIC_LIBS ON) # Force the use of static boost test framework
 find_package(Boost 1.53.0 REQUIRED COMPONENTS chrono filesystem system thread unit_test_framework)
 include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
+include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
 
 #Make sure gen-cpp files can be included
 include_directories("${CMAKE_CURRENT_BINARY_DIR}")
@@ -62,6 +63,7 @@
 target_link_libraries(Benchmark testgencpp)
 LINK_AGAINST_THRIFT_LIBRARY(Benchmark thrift)
 add_test(NAME Benchmark COMMAND Benchmark)
+target_link_libraries(Benchmark testgencpp ${ZLIB_LIBRARIES})
 
 set(UnitTest_SOURCES
     UnitTestMain.cpp
@@ -79,7 +81,8 @@
 endif()
 
 add_executable(UnitTests ${UnitTest_SOURCES})
-target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES})
+target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES})
 LINK_AGAINST_THRIFT_LIBRARY(UnitTests thrift)
 add_test(NAME UnitTests COMMAND UnitTests)
 if ( MSVC )
@@ -99,6 +102,7 @@
 target_link_libraries(TInterruptTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift)
 if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -110,6 +114,7 @@
 target_link_libraries(TServerIntegrationTest
     testgencpp_cob
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift)
 if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -144,6 +149,7 @@
 target_link_libraries(EnumTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift)
 add_test(NAME EnumTest COMMAND EnumTest)
@@ -153,6 +159,7 @@
 target_link_libraries(TFileTransportTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift)
 add_test(NAME TFileTransportTest COMMAND TFileTransportTest)
@@ -161,6 +168,7 @@
 add_executable(TFDTransportTest TFDTransportTest.cpp)
 target_link_libraries(TFDTransportTest
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift)
 add_test(NAME TFDTransportTest COMMAND TFDTransportTest)
@@ -168,6 +176,7 @@
 add_executable(TPipedTransportTest TPipedTransportTest.cpp)
 target_link_libraries(TPipedTransportTest
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift)
 add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest)
@@ -182,6 +191,7 @@
 target_link_libraries(AllProtocolsTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift)
 add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest)
@@ -192,6 +202,7 @@
 target_link_libraries(DebugProtoTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift)
 add_test(NAME DebugProtoTest COMMAND DebugProtoTest)
@@ -201,6 +212,7 @@
 target_link_libraries(JSONProtoTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift)
 add_test(NAME JSONProtoTest COMMAND JSONProtoTest)
@@ -209,6 +221,7 @@
 target_link_libraries(OptionalRequiredTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift)
 add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest)
@@ -217,6 +230,7 @@
 target_link_libraries(RecursiveTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(RecursiveTest thrift)
 add_test(NAME RecursiveTest COMMAND RecursiveTest)
@@ -225,6 +239,7 @@
 target_link_libraries(SpecializationTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift)
 add_test(NAME SpecializationTest COMMAND SpecializationTest)
@@ -238,6 +253,7 @@
 add_executable(concurrency_test ${concurrency_test_SOURCES})
 LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift)
 add_test(NAME concurrency_test COMMAND concurrency_test)
+target_link_libraries(concurrency_test ${ZLIB_LIBRARIES})
 
 set(link_test_SOURCES
     link/LinkTest.cpp
@@ -249,6 +265,7 @@
 add_executable(link_test ${link_test_SOURCES})
 target_link_libraries(link_test testgencpp_cob)
 LINK_AGAINST_THRIFT_LIBRARY(link_test thrift)
+target_link_libraries(link_test testgencpp ${ZLIB_LIBRARIES})
 add_test(NAME link_test COMMAND link_test)
 
 if(WITH_LIBEVENT)
@@ -264,6 +281,7 @@
 target_link_libraries(processor_test
     testgencpp_cob
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(processor_test thrift)
 LINK_AGAINST_THRIFT_LIBRARY(processor_test thriftnb)
@@ -276,6 +294,7 @@
     testgencpp_cob
     ${LIBEVENT_LIBRARIES}
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift)
 LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb)
@@ -287,6 +306,7 @@
 target_link_libraries(OpenSSLManualInitTest
     ${OPENSSL_LIBRARIES}
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift)
 add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest)
@@ -295,6 +315,7 @@
 target_link_libraries(SecurityTest
     testgencpp
     ${Boost_LIBRARIES}
+    ${ZLIB_LIBRARIES}
 )
 LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift)
 if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")