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_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED AND
9    (CONFIG_NET_SAMPLE_PSK_HEADER_FILE STREQUAL "dummy_psk.h"))
10  add_custom_target(development_psk
11    COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------"
12    COMMAND ${CMAKE_COMMAND} -E echo "--- WARNING: Using dummy PSK! Only suitable for        ---"
13    COMMAND ${CMAKE_COMMAND} -E echo "--- development. Set NET_SAMPLE_PSK_HEADER_FILE to use ---"
14    COMMAND ${CMAKE_COMMAND} -E echo "--- own pre-shared key.                                ---"
15    COMMAND ${CMAKE_COMMAND} -E echo "----------------------------------------------------------"
16  )
17  add_dependencies(app development_psk)
18endif()
19
20target_sources(                     app PRIVATE src/echo-client.c)
21target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c)
22target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c)
23target_sources_ifdef(CONFIG_NET_VLAN app PRIVATE src/vlan.c)
24
25include(${ZEPHYR_BASE}/samples/net/common/common.cmake)
26
27set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/)
28
29generate_inc_file_for_target(
30    app
31    src/echo-apps-cert.der
32    ${gen_dir}/echo-apps-cert.der.inc
33    )
34