tls: remove api boilerplate
[vpp.git] / src / plugins / tlsopenssl / CMakeLists.txt
index 7659cc0..8ac36cf 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+include (CheckFunctionExists)
 if(OPENSSL_FOUND)
-  add_vpp_plugin(tlsopenssl_plugin tls_openssl.c tls_async.c)
-  target_link_libraries(tlsopenssl_plugin ${OPENSSL_LIBRARIES})
+  include_directories(${OPENSSL_INCLUDE_DIR})
+  add_vpp_plugin(tlsopenssl
+    SOURCES
+    tls_openssl.c
+    tls_openssl_api.c
+    tls_async.c
+
+    API_FILES
+    tls_openssl.api
+
+    API_TEST_SOURCES
+    tls_openssl_test.c
+
+    LINK_LIBRARIES
+    ${OPENSSL_LIBRARIES}
+  )
+
+  set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
+  set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}")
+  check_function_exists(SSL_set_async_callback HAVE_OPENSSL_ASYNC)
+
+  if (HAVE_OPENSSL_ASYNC)
+    add_definitions(-DHAVE_OPENSSL_ASYNC)
+  endif()
+
+
 endif()