THRIFT-5047:fix openssl switch
Client: cpp
Patch: Yuanyuan Chen

This closes #1962
diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
index 9b987ae..d705bb3 100755
--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -125,11 +125,17 @@
 set( thriftcppnb_SOURCES
     src/thrift/server/TNonblockingServer.cpp
     src/thrift/transport/TNonblockingServerSocket.cpp
-    src/thrift/transport/TNonblockingSSLServerSocket.cpp
     src/thrift/async/TEvhttpServer.cpp
     src/thrift/async/TEvhttpClientChannel.cpp
 )
 
+# If OpenSSL is not found or disabled just ignore the OpenSSL stuff
+if(OPENSSL_FOUND AND WITH_OPENSSL)
+    list( APPEND thriftcppnb_SOURCES
+    src/thrift/transport/TNonblockingSSLServerSocket.cpp
+    )
+endif()
+
 # Thrift zlib transport
 set( thriftcppz_SOURCES
     src/thrift/transport/TZlibTransport.cpp