1# SPDX-License-Identifier: Apache-2.0
2
3cmake_minimum_required(VERSION 3.20.0)
4
5find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6project(sockets_echo_client)
7
8if(CONFIG_NET_SOCKETS_SOCKOPT_TLS AND
9   CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED AND
10   (CONFIG_NET_SAMPLE_PSK_HEADER_FILE STREQUAL "dummy_psk.h"))
11  add_custom_target(development_psk
12    COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------"
13    COMMAND ${CMAKE_COMMAND} -E echo "--- WARNING: Using dummy PSK! Only suitable for        ---"
14    COMMAND ${CMAKE_COMMAND} -E echo "--- development. Set NET_SAMPLE_PSK_HEADER_FILE to use ---"
15    COMMAND ${CMAKE_COMMAND} -E echo "--- own pre-shared key.                                ---"
16    COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------"
17  )
18  add_dependencies(app development_psk)
19endif()
20
21target_sources(                     app PRIVATE src/echo-client.c)
22target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c)
23target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c)
24target_sources_ifdef(CONFIG_NET_VLAN app PRIVATE src/vlan.c)
25
26include(${ZEPHYR_BASE}/samples/net/common/common.cmake)
27
28set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/)
29
30generate_inc_file_for_target(
31    app
32    src/echo-apps-cert.der
33    ${gen_dir}/echo-apps-cert.der.inc
34    )
35