1set(p256m_target ${MBEDTLS_TARGET_PREFIX}p256m)
2
3add_library(${p256m_target}
4    p256-m_driver_entrypoints.c
5    p256-m/p256-m.c)
6
7target_include_directories(${p256m_target}
8  PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
9         $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/p256-m>
10         $<BUILD_INTERFACE:${MBEDTLS_DIR}/include>
11         $<INSTALL_INTERFACE:include>
12  PRIVATE ${MBEDTLS_DIR}/library/)
13
14# Pass-through MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE
15# This must be duplicated from library/CMakeLists.txt because
16# p256m is not directly linked against any mbedtls targets
17# so does not inherit the compile definitions.
18if(MBEDTLS_CONFIG_FILE)
19    target_compile_definitions(${p256m_target}
20        PUBLIC MBEDTLS_CONFIG_FILE="${MBEDTLS_CONFIG_FILE}")
21endif()
22if(MBEDTLS_USER_CONFIG_FILE)
23    target_compile_definitions(${p256m_target}
24        PUBLIC MBEDTLS_USER_CONFIG_FILE="${MBEDTLS_USER_CONFIG_FILE}")
25endif()
26
27if(INSTALL_MBEDTLS_HEADERS)
28
29  install(DIRECTORY :${CMAKE_CURRENT_SOURCE_DIR}
30    DESTINATION include
31    FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
32    DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
33    FILES_MATCHING PATTERN "*.h")
34
35endif(INSTALL_MBEDTLS_HEADERS)
36
37install(TARGETS ${p256m_target}
38EXPORT MbedTLSTargets
39DESTINATION ${CMAKE_INSTALL_LIBDIR}
40PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
41