Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 1 | set(src_x509 |
Harry Ramsey | 798d8b6 | 2024-10-11 17:09:18 +0100 | [diff] [blame] | 2 | error.c |
Daniel Axtens | aa91d4e | 2020-05-29 00:23:21 +1000 | [diff] [blame] | 3 | pkcs7.c |
Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 4 | x509.c |
| 5 | x509_create.c |
| 6 | x509_crl.c |
| 7 | x509_crt.c |
| 8 | x509_csr.c |
Gilles Peskine | d2fe51c | 2025-05-07 20:36:20 +0200 | [diff] [blame] | 9 | x509_oid.c |
Andrzej Kurek | c508dc2 | 2023-07-07 08:20:02 -0400 | [diff] [blame] | 10 | x509write.c |
Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 11 | x509write_crt.c |
| 12 | x509write_csr.c |
| 13 | ) |
| 14 | |
| 15 | set(src_tls |
| 16 | debug.c |
Gilles Peskine | 89e31ad | 2022-11-26 14:18:45 +0100 | [diff] [blame] | 17 | mps_reader.c |
| 18 | mps_trace.c |
Andres AG | 788aa4a | 2016-09-14 14:32:09 +0100 | [diff] [blame] | 19 | net_sockets.c |
Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 20 | ssl_cache.c |
| 21 | ssl_ciphersuites.c |
Ronald Cron | 3d580bf | 2022-02-18 17:24:56 +0100 | [diff] [blame] | 22 | ssl_client.c |
Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 23 | ssl_cookie.c |
Gilles Peskine | 898db6b | 2022-11-26 14:15:32 +0100 | [diff] [blame] | 24 | ssl_debug_helpers_generated.c |
Hanno Becker | 6e7051a | 2020-02-05 11:33:54 +0000 | [diff] [blame] | 25 | ssl_msg.c |
Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 26 | ssl_ticket.c |
Hanno Becker | 471c0c9 | 2020-02-05 11:32:03 +0000 | [diff] [blame] | 27 | ssl_tls.c |
Ronald Cron | de1adee | 2022-03-07 16:20:30 +0100 | [diff] [blame] | 28 | ssl_tls12_client.c |
| 29 | ssl_tls12_server.c |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 30 | ssl_tls13_keys.c |
Jerry Yu | 3cc4c2a | 2021-08-06 16:29:08 +0800 | [diff] [blame] | 31 | ssl_tls13_server.c |
| 32 | ssl_tls13_client.c |
Jerry Yu | 65dd2cc | 2021-08-18 16:38:40 +0800 | [diff] [blame] | 33 | ssl_tls13_generic.c |
Ronald Cron | 6924564 | 2024-11-12 18:14:23 +0100 | [diff] [blame] | 34 | timing.c |
Harry Ramsey | 468c0ae | 2024-09-27 14:38:53 +0100 | [diff] [blame] | 35 | version.c |
| 36 | version_features.c |
Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 37 | ) |
| 38 | |
David Horstmann | a8d1406 | 2021-10-20 17:14:23 +0100 | [diff] [blame] | 39 | if(GEN_FILES) |
Harry Ramsey | 798d8b6 | 2024-10-11 17:09:18 +0100 | [diff] [blame] | 40 | find_package(Perl REQUIRED) |
| 41 | |
| 42 | file(GLOB crypto_error_headers ${CMAKE_CURRENT_SOURCE_DIR}/include/mbedtls/*.h) |
| 43 | file(GLOB tls_error_headers ${MBEDTLS_DIR}/include/mbedtls/*.h) |
| 44 | add_custom_command( |
| 45 | OUTPUT |
| 46 | ${CMAKE_CURRENT_BINARY_DIR}/error.c |
| 47 | COMMAND |
| 48 | ${PERL_EXECUTABLE} |
| 49 | ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_errors.pl |
| 50 | ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/drivers/builtin/include/mbedtls |
| 51 | ${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls |
| 52 | ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files |
| 53 | ${CMAKE_CURRENT_BINARY_DIR}/${TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_DIR}/error.c |
| 54 | DEPENDS |
| 55 | ${MBEDTLS_DIR}/scripts/generate_errors.pl |
| 56 | ${crypto_error_headers} |
| 57 | ${tls_error_headers} |
| 58 | ${MBEDTLS_DIR}/scripts/data_files/error.fmt |
| 59 | ) |
Jerry Yu | eb96fb5 | 2021-12-02 11:03:59 +0800 | [diff] [blame] | 60 | add_custom_command( |
| 61 | OUTPUT |
Harry Ramsey | 468c0ae | 2024-09-27 14:38:53 +0100 | [diff] [blame] | 62 | ${CMAKE_CURRENT_BINARY_DIR}/version_features.c |
| 63 | COMMAND |
| 64 | ${PERL_EXECUTABLE} |
| 65 | ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_features.pl |
| 66 | ${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls |
| 67 | ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files |
| 68 | ${CMAKE_CURRENT_BINARY_DIR}/version_features.c |
| 69 | DEPENDS |
| 70 | ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_features.pl |
| 71 | ${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls/mbedtls_config.h |
| 72 | ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files/version_features.fmt |
| 73 | ) |
| 74 | |
| 75 | add_custom_command( |
| 76 | OUTPUT |
Jerry Yu | eb96fb5 | 2021-12-02 11:03:59 +0800 | [diff] [blame] | 77 | ${CMAKE_CURRENT_BINARY_DIR}/ssl_debug_helpers_generated.c |
| 78 | COMMAND |
| 79 | ${MBEDTLS_PYTHON_EXECUTABLE} |
Elena Uziunaite | 09fee36 | 2024-10-07 17:40:21 +0100 | [diff] [blame] | 80 | ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_ssl_debug_helpers.py |
Jerry Yu | e6369b0 | 2021-12-02 13:51:26 +0800 | [diff] [blame] | 81 | --mbedtls-root ${CMAKE_CURRENT_SOURCE_DIR}/.. |
| 82 | ${CMAKE_CURRENT_BINARY_DIR} |
Jerry Yu | eb96fb5 | 2021-12-02 11:03:59 +0800 | [diff] [blame] | 83 | DEPENDS |
Elena Uziunaite | 09fee36 | 2024-10-07 17:40:21 +0100 | [diff] [blame] | 84 | ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_ssl_debug_helpers.py |
Ronald Cron | 3d817ad | 2024-06-14 08:43:28 +0200 | [diff] [blame] | 85 | ${tls_error_headers} |
Jerry Yu | eb96fb5 | 2021-12-02 11:03:59 +0800 | [diff] [blame] | 86 | ) |
Manuel Pégourié-Gonnard | e90e405 | 2021-09-08 13:27:09 +0200 | [diff] [blame] | 87 | else() |
Harry Ramsey | 798d8b6 | 2024-10-11 17:09:18 +0100 | [diff] [blame] | 88 | link_to_source(error.c) |
Harry Ramsey | 468c0ae | 2024-09-27 14:38:53 +0100 | [diff] [blame] | 89 | link_to_source(version_features.c) |
Jerry Yu | eb96fb5 | 2021-12-02 11:03:59 +0800 | [diff] [blame] | 90 | link_to_source(ssl_debug_helpers_generated.c) |
Manuel Pégourié-Gonnard | e90e405 | 2021-09-08 13:27:09 +0200 | [diff] [blame] | 91 | endif() |
Manuel Pégourié-Gonnard | 65a7203 | 2021-05-11 13:02:44 +0200 | [diff] [blame] | 92 | |
Paul Bakker | 76f0311 | 2013-11-28 17:20:04 +0100 | [diff] [blame] | 93 | if(CMAKE_COMPILER_IS_GNUCC) |
Ronald Cron | 50bd4f8 | 2024-10-10 12:17:59 +0200 | [diff] [blame] | 94 | set(LIBS_C_FLAGS -Wmissing-declarations) |
Paul Bakker | 76f0311 | 2013-11-28 17:20:04 +0100 | [diff] [blame] | 95 | endif(CMAKE_COMPILER_IS_GNUCC) |
| 96 | |
Manuel Pégourié-Gonnard | 3185545 | 2014-06-25 15:59:50 +0200 | [diff] [blame] | 97 | if(CMAKE_COMPILER_IS_CLANG) |
Ronald Cron | 50bd4f8 | 2024-10-10 12:17:59 +0200 | [diff] [blame] | 98 | set(LIBS_C_FLAGS -Wmissing-declarations -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code) |
Manuel Pégourié-Gonnard | 3185545 | 2014-06-25 15:59:50 +0200 | [diff] [blame] | 99 | endif(CMAKE_COMPILER_IS_CLANG) |
| 100 | |
Krzysztof Stachowiak | de6effa | 2018-10-31 12:46:37 +0100 | [diff] [blame] | 101 | if(CMAKE_COMPILER_IS_MSVC) |
| 102 | option(MSVC_STATIC_RUNTIME "Build the libraries with /MT compiler flag" OFF) |
| 103 | if(MSVC_STATIC_RUNTIME) |
| 104 | foreach(flag_var |
| 105 | CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
| 106 | CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO |
| 107 | CMAKE_C_FLAGS_CHECK) |
| 108 | string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") |
| 109 | endforeach(flag_var) |
| 110 | endif() |
| 111 | endif() |
| 112 | |
Signed-off-by: Steven WdV | bcfed50 | 2024-02-29 15:12:36 +0100 | [diff] [blame] | 113 | if(CMAKE_C_COMPILER_ID MATCHES "AppleClang") |
| 114 | set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") |
Signed-off-by: Steven WdV | bcfed50 | 2024-02-29 15:12:36 +0100 | [diff] [blame] | 115 | set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>") |
Steven WdV | 9f0858d | 2024-03-19 11:39:22 +0100 | [diff] [blame] | 116 | endif() |
| 117 | if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") |
| 118 | set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") |
Signed-off-by: Steven WdV | bcfed50 | 2024-02-29 15:12:36 +0100 | [diff] [blame] | 119 | set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>") |
Andres Amaya Garcia | bf7fe4f | 2018-06-21 20:21:38 +0100 | [diff] [blame] | 120 | endif() |
TabascoEye | 7f3ef27 | 2018-04-27 13:14:59 +0200 | [diff] [blame] | 121 | |
Augustin Cavalier | 60bc47d | 2018-04-11 20:27:32 -0400 | [diff] [blame] | 122 | if(HAIKU) |
Simon Butcher | 6331cb0 | 2018-07-10 11:48:42 +0100 | [diff] [blame] | 123 | set(libs ${libs} network) |
Augustin Cavalier | 60bc47d | 2018-04-11 20:27:32 -0400 | [diff] [blame] | 124 | endif(HAIKU) |
| 125 | |
Manuel Pégourié-Gonnard | ba2c876 | 2015-06-25 09:35:46 +0200 | [diff] [blame] | 126 | if(LINK_WITH_PTHREAD) |
Paul Elliott | 7fd162e | 2024-01-24 18:05:53 +0000 | [diff] [blame] | 127 | set(libs ${libs} ${CMAKE_THREAD_LIBS_INIT}) |
Manuel Pégourié-Gonnard | ba2c876 | 2015-06-25 09:35:46 +0200 | [diff] [blame] | 128 | endif() |
| 129 | |
Manuel Pégourié-Gonnard | 9014b6f | 2015-01-27 15:44:46 +0000 | [diff] [blame] | 130 | if (NOT USE_STATIC_MBEDTLS_LIBRARY AND NOT USE_SHARED_MBEDTLS_LIBRARY) |
Manuel Pégourié-Gonnard | 216a183 | 2015-06-25 09:20:03 +0200 | [diff] [blame] | 131 | message(FATAL_ERROR "Need to choose static or shared mbedtls build!") |
Manuel Pégourié-Gonnard | 9014b6f | 2015-01-27 15:44:46 +0000 | [diff] [blame] | 132 | endif(NOT USE_STATIC_MBEDTLS_LIBRARY AND NOT USE_SHARED_MBEDTLS_LIBRARY) |
Paul Bakker | 9d3a7e4 | 2011-01-05 15:24:43 +0000 | [diff] [blame] | 133 | |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 134 | set(mbedtls_target "${MBEDTLS_TARGET_PREFIX}mbedtls") |
| 135 | set(mbedx509_target "${MBEDTLS_TARGET_PREFIX}mbedx509") |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 136 | |
| 137 | set(mbedtls_target ${mbedtls_target} PARENT_SCOPE) |
| 138 | set(mbedx509_target ${mbedx509_target} PARENT_SCOPE) |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 139 | |
| 140 | if (USE_STATIC_MBEDTLS_LIBRARY) |
Ronald Cron | f8a3f28 | 2024-07-24 08:42:32 +0200 | [diff] [blame] | 141 | set(mbedtls_static_target ${mbedtls_target}) |
| 142 | set(mbedx509_static_target ${mbedx509_target}) |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 143 | endif() |
| 144 | |
Ronald Cron | e82ad15 | 2024-07-19 12:01:43 +0200 | [diff] [blame] | 145 | set(target_libraries ${mbedx509_target} ${mbedtls_target}) |
Gilles Peskine | 3ca8a92 | 2020-07-02 13:07:37 +0200 | [diff] [blame] | 146 | |
Manuel Pégourié-Gonnard | 9014b6f | 2015-01-27 15:44:46 +0000 | [diff] [blame] | 147 | if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY) |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 148 | string(APPEND mbedtls_static_target "_static") |
| 149 | string(APPEND mbedx509_static_target "_static") |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 150 | |
Gilles Peskine | 3ca8a92 | 2020-07-02 13:07:37 +0200 | [diff] [blame] | 151 | list(APPEND target_libraries |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 152 | ${mbedx509_static_target} |
| 153 | ${mbedtls_static_target}) |
hasufell | 3c6409b | 2014-03-06 15:49:08 +0100 | [diff] [blame] | 154 | endif() |
Paul Bakker | 9d3a7e4 | 2011-01-05 15:24:43 +0000 | [diff] [blame] | 155 | |
Manuel Pégourié-Gonnard | 9014b6f | 2015-01-27 15:44:46 +0000 | [diff] [blame] | 156 | if(USE_STATIC_MBEDTLS_LIBRARY) |
Gilles Peskine | 55d5353 | 2020-03-09 17:48:13 +0100 | [diff] [blame] | 157 | add_library(${mbedx509_static_target} STATIC ${src_x509}) |
Ronald Cron | b247898 | 2024-10-07 16:17:07 +0200 | [diff] [blame] | 158 | set_base_compile_options(${mbedx509_static_target}) |
Ronald Cron | 50bd4f8 | 2024-10-10 12:17:59 +0200 | [diff] [blame] | 159 | target_compile_options(${mbedx509_static_target} PRIVATE ${LIBS_C_FLAGS}) |
Gilles Peskine | 55d5353 | 2020-03-09 17:48:13 +0100 | [diff] [blame] | 160 | set_target_properties(${mbedx509_static_target} PROPERTIES OUTPUT_NAME mbedx509) |
Ronald Cron | b7d0e52 | 2024-10-25 16:01:14 +0200 | [diff] [blame] | 161 | target_link_libraries(${mbedx509_static_target} PUBLIC ${libs} ${tfpsacrypto_static_target}) |
Manuel Pégourié-Gonnard | c7781ad | 2015-06-25 09:49:02 +0200 | [diff] [blame] | 162 | |
Gilles Peskine | 55d5353 | 2020-03-09 17:48:13 +0100 | [diff] [blame] | 163 | add_library(${mbedtls_static_target} STATIC ${src_tls}) |
Ronald Cron | b247898 | 2024-10-07 16:17:07 +0200 | [diff] [blame] | 164 | set_base_compile_options(${mbedtls_static_target}) |
Ronald Cron | 50bd4f8 | 2024-10-10 12:17:59 +0200 | [diff] [blame] | 165 | target_compile_options(${mbedtls_static_target} PRIVATE ${LIBS_C_FLAGS}) |
Gilles Peskine | 55d5353 | 2020-03-09 17:48:13 +0100 | [diff] [blame] | 166 | set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls) |
Raef Coles | 4762edd | 2020-10-13 16:31:41 +0100 | [diff] [blame] | 167 | target_link_libraries(${mbedtls_static_target} PUBLIC ${libs} ${mbedx509_static_target}) |
Manuel Pégourié-Gonnard | e1d34d1 | 2015-06-25 14:53:13 +0200 | [diff] [blame] | 168 | endif(USE_STATIC_MBEDTLS_LIBRARY) |
Paul Bakker | 9d3a7e4 | 2011-01-05 15:24:43 +0000 | [diff] [blame] | 169 | |
Manuel Pégourié-Gonnard | 9014b6f | 2015-01-27 15:44:46 +0000 | [diff] [blame] | 170 | if(USE_SHARED_MBEDTLS_LIBRARY) |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 171 | add_library(${mbedx509_target} SHARED ${src_x509}) |
Ronald Cron | b247898 | 2024-10-07 16:17:07 +0200 | [diff] [blame] | 172 | set_base_compile_options(${mbedx509_target}) |
Ronald Cron | 50bd4f8 | 2024-10-10 12:17:59 +0200 | [diff] [blame] | 173 | target_compile_options(${mbedx509_target} PRIVATE ${LIBS_C_FLAGS}) |
David Horstmann | 7ba04a2 | 2024-09-03 17:36:30 +0100 | [diff] [blame] | 174 | set_target_properties(${mbedx509_target} PROPERTIES VERSION 4.0.0 SOVERSION 7) |
Ronald Cron | b7d0e52 | 2024-10-25 16:01:14 +0200 | [diff] [blame] | 175 | target_link_libraries(${mbedx509_target} PUBLIC ${libs} ${tfpsacrypto_target}) |
Manuel Pégourié-Gonnard | c7781ad | 2015-06-25 09:49:02 +0200 | [diff] [blame] | 176 | |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 177 | add_library(${mbedtls_target} SHARED ${src_tls}) |
Ronald Cron | b247898 | 2024-10-07 16:17:07 +0200 | [diff] [blame] | 178 | set_base_compile_options(${mbedtls_target}) |
Ronald Cron | 50bd4f8 | 2024-10-10 12:17:59 +0200 | [diff] [blame] | 179 | target_compile_options(${mbedtls_target} PRIVATE ${LIBS_C_FLAGS}) |
David Horstmann | 7ba04a2 | 2024-09-03 17:36:30 +0100 | [diff] [blame] | 180 | set_target_properties(${mbedtls_target} PROPERTIES VERSION 4.0.0 SOVERSION 21) |
Raef Coles | 4762edd | 2020-10-13 16:31:41 +0100 | [diff] [blame] | 181 | target_link_libraries(${mbedtls_target} PUBLIC ${libs} ${mbedx509_target}) |
Manuel Pégourié-Gonnard | 9014b6f | 2015-01-27 15:44:46 +0000 | [diff] [blame] | 182 | endif(USE_SHARED_MBEDTLS_LIBRARY) |
Manuel Pégourié-Gonnard | e1d34d1 | 2015-06-25 14:53:13 +0200 | [diff] [blame] | 183 | |
Gilles Peskine | 3ca8a92 | 2020-07-02 13:07:37 +0200 | [diff] [blame] | 184 | foreach(target IN LISTS target_libraries) |
Robert Shade | 591e729 | 2022-05-12 14:40:16 -0400 | [diff] [blame] | 185 | add_library(MbedTLS::${target} ALIAS ${target}) # add_subdirectory support |
Ronald Cron | aef8cf3 | 2024-07-01 18:33:24 +0200 | [diff] [blame] | 186 | # Include public header files from /include, /tf-psa-crypto/include/ and |
| 187 | # tf-psa-crypto/drivers/builtin/include/. Include private header files |
| 188 | # from /library, tf-psa-crypto/core/ and tf-psa-crypto/drivers/builtin/src/. |
Gilles Peskine | 3ca8a92 | 2020-07-02 13:07:37 +0200 | [diff] [blame] | 189 | target_include_directories(${target} |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 190 | PUBLIC $<BUILD_INTERFACE:${MBEDTLS_DIR}/include/> |
Ronald Cron | c7e9e36 | 2024-06-10 09:41:49 +0200 | [diff] [blame] | 191 | $<BUILD_INTERFACE:${MBEDTLS_DIR}/tf-psa-crypto/include/> |
Ronald Cron | 3d817ad | 2024-06-14 08:43:28 +0200 | [diff] [blame] | 192 | $<BUILD_INTERFACE:${MBEDTLS_DIR}/tf-psa-crypto/drivers/builtin/include/> |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 193 | $<INSTALL_INTERFACE:include/> |
David Horstmann | b7b4f23 | 2023-09-27 13:57:11 +0100 | [diff] [blame] | 194 | PRIVATE ${MBEDTLS_DIR}/library/ |
Ronald Cron | c29afb6 | 2024-07-01 14:50:54 +0200 | [diff] [blame] | 195 | ${MBEDTLS_DIR}/tf-psa-crypto/core |
Ronald Cron | e82ad15 | 2024-07-19 12:01:43 +0200 | [diff] [blame] | 196 | ${MBEDTLS_DIR}/tf-psa-crypto/drivers/builtin/src) |
Ronald Cron | 211bf6d | 2024-10-23 14:22:03 +0200 | [diff] [blame] | 197 | set_config_files_compile_definitions(${target}) |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 198 | install( |
| 199 | TARGETS ${target} |
| 200 | EXPORT MbedTLSTargets |
Biswapriyo Nath | d7e0ee4 | 2022-04-22 20:59:50 +0530 | [diff] [blame] | 201 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 202 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 203 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 204 | PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) |
Gilles Peskine | 3ca8a92 | 2020-07-02 13:07:37 +0200 | [diff] [blame] | 205 | endforeach(target) |
Manuel Pégourié-Gonnard | e1d34d1 | 2015-06-25 14:53:13 +0200 | [diff] [blame] | 206 | |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 207 | set(lib_target "${MBEDTLS_TARGET_PREFIX}lib") |
| 208 | |
Ronald Cron | e82ad15 | 2024-07-19 12:01:43 +0200 | [diff] [blame] | 209 | add_custom_target(${lib_target} DEPENDS ${mbedx509_target} ${mbedtls_target}) |
Gilles Peskine | 55d5353 | 2020-03-09 17:48:13 +0100 | [diff] [blame] | 210 | if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY) |
Ronald Cron | e82ad15 | 2024-07-19 12:01:43 +0200 | [diff] [blame] | 211 | add_dependencies(${lib_target} ${mbedx509_static_target} ${mbedtls_static_target}) |
Manuel Pégourié-Gonnard | e1d34d1 | 2015-06-25 14:53:13 +0200 | [diff] [blame] | 212 | endif() |
Ronald Cron | 0381a98 | 2024-11-05 12:21:26 +0100 | [diff] [blame] | 213 | |
| 214 | foreach(target IN LISTS tf_psa_crypto_library_targets) |
| 215 | get_target_property(target_type ${target} TYPE) |
| 216 | if (target_type STREQUAL STATIC_LIBRARY) |
| 217 | add_custom_command( |
| 218 | TARGET ${mbedtls_target} |
| 219 | POST_BUILD |
| 220 | COMMAND ${CMAKE_COMMAND} |
| 221 | ARGS -E copy $<TARGET_FILE:${target}> ${CMAKE_BINARY_DIR}/library) |
| 222 | else() |
| 223 | add_custom_command( |
| 224 | TARGET ${mbedtls_target} |
| 225 | POST_BUILD |
| 226 | COMMAND ${CMAKE_COMMAND} |
| 227 | ARGS -E copy $<TARGET_FILE:${target}> |
| 228 | ${CMAKE_BINARY_DIR}/library/$<TARGET_FILE_NAME:${target}>) |
| 229 | add_custom_command( |
| 230 | TARGET ${mbedtls_target} |
| 231 | POST_BUILD |
| 232 | COMMAND ${CMAKE_COMMAND} |
| 233 | ARGS -E copy $<TARGET_LINKER_FILE:${target}> |
| 234 | ${CMAKE_BINARY_DIR}/library/$<TARGET_LINKER_FILE_NAME:${target}>) |
| 235 | endif() |
| 236 | endforeach(target) |