1set(executables
2    aead_demo
3    crypto_examples
4    hmac_demo
5    key_ladder_demo
6    psa_constant_names
7)
8
9if(GEN_FILES)
10    add_custom_command(
11        OUTPUT
12            ${CMAKE_CURRENT_BINARY_DIR}/psa_constant_names_generated.c
13        COMMAND
14            ${MBEDTLS_PYTHON_EXECUTABLE}
15                ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/generate_psa_constants.py
16                ${CMAKE_CURRENT_BINARY_DIR}
17        WORKING_DIRECTORY
18            ${CMAKE_CURRENT_SOURCE_DIR}/../..
19        DEPENDS
20            ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/generate_psa_constants.py
21            ${CMAKE_CURRENT_SOURCE_DIR}/../../include/psa/crypto_values.h
22            ${CMAKE_CURRENT_SOURCE_DIR}/../../include/psa/crypto_extra.h
23    )
24else()
25    link_to_source(psa_constant_names_generated.c)
26endif()
27
28foreach(exe IN LISTS executables)
29    add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
30    target_link_libraries(${exe} ${mbedcrypto_target})
31    target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
32endforeach()
33
34target_include_directories(psa_constant_names PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
35if(GEN_FILES)
36    add_custom_target(generate_psa_constant_names_generated_c
37        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/psa_constant_names_generated.c)
38    add_dependencies(psa_constant_names generate_psa_constant_names_generated_c)
39endif()
40
41install(TARGETS ${executables}
42        DESTINATION "bin"
43        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
44
45install(PROGRAMS
46            key_ladder_demo.sh
47        DESTINATION "bin")
48