03f8a17fe8601b85c97127d898a87eb88ffa81de
[vpp.git] / src / plugins / tlsmbedtls / CMakeLists.txt
1 # Copyright (c) 2018 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 message(STATUS "Looking for mbedTLS")
15 find_path(MBEDTLS_INCLUDE_DIR NAMES mbedtls/ssl.h)
16 find_library(MBEDTLS_LIB1 NAMES mbedtls)
17 find_library(MBEDTLS_LIB2 NAMES mbedx509)
18 find_library(MBEDTLS_LIB3 NAMES mbedcrypto)
19
20 set (MBEDTLS_LIB ${MBEDTLS_LIB1} ${MBEDTLS_LIB2} ${MBEDTLS_LIB3})
21
22 if(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIB)
23   include_directories(${MBEDTLS_INCLUDE_DIR})
24   add_vpp_plugin(tlsmbedtls_plugin tls_mbedtls.c)
25   target_link_libraries(tlsmbedtls_plugin ${MBEDTLS_LIB})
26   message(STATUS "Found mbedTLS in ${MBEDTLS_INCLUDE_DIR}")
27 else()
28   message(WARNING "-- mbedTLS not found - tlsmbedtls_plugin disabled")
29 endif()
30