THRIFT-4759:add thrift export to fix windows shared lib building (#1714)

* add THRIFT_EXPORT to fix windows shared lib building
* use shared libraries on vs2017 appveyor build, leave msvc2017 static link
diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
index dd90c80..e92da60 100755
--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -23,6 +23,10 @@
 
 include_directories(src)
 
+if(NOT BUILD_SHARED_LIBS)
+  add_definitions("-DTHRIFT_STATIC_DEFINE")
+endif()
+
 # SYSLIBS contains libraries that need to be linked to all lib targets
 set(SYSLIBS "")