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