--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -98,13 +98,13 @@ else()
 endif()
 
 # If OpenSSL is not found or disabled just ignore the OpenSSL stuff
-if(OPENSSL_FOUND AND WITH_OPENSSL)
+if(WITH_OPENSSL)
     list( APPEND thriftcpp_SOURCES
        src/thrift/transport/TSSLSocket.cpp
        src/thrift/transport/TSSLServerSocket.cpp
     )
-    include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
-    list(APPEND SYSLIBS "${OPENSSL_LIBRARIES}")
+    #include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
+    list(APPEND SYSLIBS OpenSSL::OpenSSL)
 endif()
 
 if(UNIX)
@@ -152,11 +152,11 @@ ADD_PKGCONFIG_THRIFT(thrift)
 
 if(WITH_LIBEVENT)
     find_package(Libevent REQUIRED)  # Libevent comes with CMake support form upstream
-    include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS})
+    #include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS})
 
     ADD_LIBRARY_THRIFT(thriftnb ${thriftcppnb_SOURCES})
     LINK_AGAINST_THRIFT_LIBRARY(thriftnb thrift)
-    TARGET_LINK_LIBRARIES_THRIFT(thriftnb ${SYSLIBS} ${LIBEVENT_LIBRARIES})
+    TARGET_LINK_LIBRARIES_THRIFT(thriftnb ${SYSLIBS} libevent::libevent)
     ADD_PKGCONFIG_THRIFT(thrift-nb)
 endif()

--- a/lib/c_glib/CMakeLists.txt
+++ b/lib/c_glib/CMakeLists.txt
@@ -60,10 +60,10 @@ set(thrift_c_glib_SOURCES
 
 # If OpenSSL is not found just ignore the OpenSSL stuff
-find_package(OpenSSL)
-if(OPENSSL_FOUND AND WITH_OPENSSL)
+if(WITH_OPENSSL)
+    find_package(OpenSSL REQUIRED)
     list( APPEND thrift_c_glib_SOURCES
 	    src/thrift/c_glib/transport/thrift_ssl_socket.c
     )
-    include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
-    list(APPEND SYSLIBS "${OPENSSL_LIBRARIES}")
+    #include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
+    list(APPEND SYSLIBS OpenSSL::OpenSSL)
 endif()
