CMakeLists.txt 1.6 KB

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