1# SPDX-License-Identifier: Apache-2.0
2
3cmake_minimum_required(VERSION 3.20.0)
4find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5project(tls_socket_api_extension)
6
7set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/)
8
9if (${CONFIG_TLS_CREDENTIALS})
10  generate_inc_file_for_target(
11    app
12    ${ZEPHYR_BASE}/samples/net/sockets/echo_server/src/ca.der
13    ${gen_dir}/ca.inc
14  )
15
16  generate_inc_file_for_target(
17    app
18    ${ZEPHYR_BASE}/samples/net/sockets/echo_server/src/server.der
19    ${gen_dir}/server.inc
20  )
21
22  generate_inc_file_for_target(
23    app
24    ${ZEPHYR_BASE}/samples/net/sockets/echo_server/src/server_privkey.der
25    ${gen_dir}/server_privkey.inc
26  )
27
28  # we reuse the same certificate / private key for client
29  # since it seems to be the only one that is signed by a ca
30  generate_inc_file_for_target(
31    app
32    ${ZEPHYR_BASE}/samples/net/sockets/echo_server/src/server.der
33    ${gen_dir}/client.inc
34  )
35
36  generate_inc_file_for_target(
37    app
38    ${ZEPHYR_BASE}/samples/net/sockets/echo_server/src/server_privkey.der
39    ${gen_dir}/client_privkey.inc
40  )
41endif()
42
43FILE(GLOB app_sources src/*.c)
44target_sources(app PRIVATE ${app_sources})
45