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