Skip to content

Commit 02b08f3

Browse files
adeaarmmbolivar-nordic
authored andcommitted
[nrf fromtree] Build: Clean up mbedcrypto related CMakeLists.txt
Simplify dependencies and use consistent style for mbedTLS related targets both in BL2 and TF-M Crypto. Signed-off-by: Antonio de Angelis <[email protected]> Change-Id: I45b53a3ec18f34670560f20c2151a8c5e8d6f7c6 (cherry picked from commit 126122f) Signed-off-by: Joakim Andersson <[email protected]> (cherry picked from commit 3448048)
1 parent 14e8068 commit 02b08f3

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

bl2/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,17 @@ set(CMAKE_BUILD_TYPE ${MBEDCRYPTO_BUILD_TYPE})
100100
add_subdirectory(${MBEDCRYPTO_PATH} ${CMAKE_CURRENT_BINARY_DIR}/mbedcrypto EXCLUDE_FROM_ALL)
101101
set(CMAKE_BUILD_TYPE ${SAVED_BUILD_TYPE} CACHE STRING "Build type: [Debug, Release, RelWithDebInfo, MinSizeRel]" FORCE)
102102

103-
if(NOT TARGET bl2_mbedcrypto)
104-
message(FATAL_ERROR "Target bl2_mbedcrypto does not exist. Have the patches in ${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto been applied to the mbedcrypto repo at ${MBEDCRYPTO_PATH} ?
103+
if(NOT TARGET ${MBEDTLS_TARGET_PREFIX}mbedcrypto)
104+
message(FATAL_ERROR "Target ${MBEDTLS_TARGET_PREFIX}mbedcrypto does not exist. Have the patches in ${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto been applied to the mbedcrypto repo at ${MBEDCRYPTO_PATH} ?
105105
Hint: The command might be `cd ${MBEDCRYPTO_PATH} && git apply ${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto/*.patch`")
106106
endif()
107107

108-
target_link_libraries(bl2_mbedcrypto
108+
target_link_libraries(${MBEDTLS_TARGET_PREFIX}mbedcrypto
109109
PUBLIC
110110
bl2_mbedcrypto_config
111111
)
112112

113-
target_include_directories(bl2_mbedcrypto
113+
target_include_directories(${MBEDTLS_TARGET_PREFIX}mbedcrypto
114114
PUBLIC
115115
${MBEDCRYPTO_PATH}/library
116116
)

secure_fw/partitions/crypto/CMakeLists.txt

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -170,42 +170,33 @@ set(CMAKE_BUILD_TYPE ${MBEDCRYPTO_BUILD_TYPE})
170170
add_subdirectory(${MBEDCRYPTO_PATH} ${CMAKE_CURRENT_BINARY_DIR}/mbedcrypto EXCLUDE_FROM_ALL)
171171
set(CMAKE_BUILD_TYPE ${SAVED_BUILD_TYPE} CACHE STRING "Build type: [Debug, Release, RelWithDebInfo, MinSizeRel]" FORCE)
172172

173-
if(NOT TARGET crypto_service_mbedcrypto)
174-
message(FATAL_ERROR "Target crypto_service_mbedcrypto does not exist. Have the patches in ${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto been applied to the mbedcrypto repo at ${MBEDCRYPTO_PATH} ?
173+
if(NOT TARGET ${MBEDTLS_TARGET_PREFIX}mbedcrypto)
174+
message(FATAL_ERROR "Target ${MBEDTLS_TARGET_PREFIX}mbedcrypto does not exist. Have the patches in ${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto been applied to the mbedcrypto repo at ${MBEDCRYPTO_PATH} ?
175175
Hint: The command might be `cd ${MBEDCRYPTO_PATH} && git apply ${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto/*.patch`")
176176
endif()
177177

178-
target_include_directories(crypto_service_mbedcrypto
178+
target_include_directories(${MBEDTLS_TARGET_PREFIX}mbedcrypto
179179
PUBLIC
180180
${CMAKE_CURRENT_SOURCE_DIR}
181181
)
182182

183-
target_sources(crypto_service_mbedcrypto
183+
target_sources(${MBEDTLS_TARGET_PREFIX}mbedcrypto
184184
PRIVATE
185185
$<$<NOT:$<BOOL:${CRYPTO_HW_ACCELERATOR}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_mbedcrypto_alt.c>
186186
)
187187

188-
target_compile_options(crypto_service_mbedcrypto
188+
target_compile_options(${MBEDTLS_TARGET_PREFIX}mbedcrypto
189189
PRIVATE
190190
$<$<C_COMPILER_ID:GNU>:-Wno-unused-parameter>
191191
$<$<C_COMPILER_ID:ARMClang>:-Wno-unused-parameter>
192192
)
193193

194-
target_link_libraries(crypto_service_mbedcrypto
194+
target_link_libraries(${MBEDTLS_TARGET_PREFIX}mbedcrypto
195195
PRIVATE
196196
psa_interface
197-
tfm_secure_api
198197
platform_s
199198
PUBLIC
200199
crypto_service_mbedcrypto_config
201-
)
202-
203-
target_link_libraries(crypto_service_mbedtls
204-
PRIVATE
205-
platform_s
206-
)
207-
208-
target_link_libraries(crypto_service_mbedx509
209-
PRIVATE
210-
platform_s
200+
INTERFACE
201+
platform_common_interface
211202
)

0 commit comments

Comments
 (0)