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