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