Adding zstd to build

Summary:
This is in order for us to share compression ops to oss.
Closes https://github.com/caffe2/caffe2/pull/1463

Reviewed By: hlu1

Differential Revision: D6319101

Pulled By: Yangqing

fbshipit-source-id: 16c94e71fc3efe256054a648170aaf7702e5bcfe
diff --git a/.gitmodules b/.gitmodules
index aa0a896..0435668 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -49,3 +49,6 @@
 [submodule "third_party/aten"]
 	path = third_party/aten
 	url = https://github.com/zdevito/aten
+[submodule "third_party/zstd"]
+	path = third_party/zstd
+	url = https://github.com/facebook/zstd.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cad71ac..24833f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,7 @@
 option(USE_SNPE "Use Qualcomm's SNPE library" OFF)
 option(USE_THREADS "Use Threads" ON)
 option(USE_ZMQ "Use ZMQ" OFF)
+option(USE_ZSTD "Use ZSTD" OFF)
 
 
 # ---[ CMake scripts + modules
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index bca6a02..5a1340b 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -36,7 +36,6 @@
 endif()
 
 
-
 # ---[ BLAS
 set(BLAS "Eigen" CACHE STRING "Selected BLAS library")
 set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib")
@@ -473,3 +472,7 @@
   caffe2_include_directories(${PROJECT_SOURCE_DIR}/third_party/aten/src)
   caffe2_include_directories(${PROJECT_BINARY_DIR}/caffe2/contrib/aten)
 endif()
+
+if (USE_ZSTD)
+  add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/zstd/build/cmake)
+endif()
diff --git a/third_party/zstd b/third_party/zstd
new file mode 160000
index 0000000..aec56a5
--- /dev/null
+++ b/third_party/zstd
@@ -0,0 +1 @@
+Subproject commit aec56a52fbab207fc639a1937d1e708a282edca8