blob: bac5e917a2fb5e67c4b6d665b62836cff89fa36e [file] [log] [blame]
Tamas Banc2e0c182020-01-07 15:09:16 +00001#-------------------------------------------------------------------------------
Anton Komlev1e775502025-04-25 16:37:55 +01002# SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
Tamas Banc2e0c182020-01-07 15:09:16 +00003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
David Hu1249f0d2023-12-04 22:57:56 +08008cmake_minimum_required(VERSION 3.21)
Tamas Banc2e0c182020-01-07 15:09:16 +00009
Adam Kulesza4ced6b32022-05-24 19:13:56 +020010# Default configuration of T_COSE repository
11set(T_COSE_PATH "DOWNLOAD" CACHE PATH "Path to t_cose (or DOWNLOAD to fetch automatically")
12set(T_COSE_VERSION "v2.0-alpha-2" CACHE STRING "The version of t_cose to use")
13
14fetch_remote_library(
15 LIB_NAME t_cose
16 LIB_SOURCE_PATH_VAR T_COSE_PATH
17 LIB_PATCH_DIR ${CMAKE_CURRENT_LIST_DIR}
18 LIB_BASE_DIR "${CMAKE_BINARY_DIR}/lib/ext"
19 FETCH_CONTENT_ARGS
20 GIT_REPOSITORY https://github.com/laurencelundblade/t_cose.git
21 GIT_TAG ${T_COSE_VERSION}
22 GIT_SHALLOW TRUE
23 GIT_PROGRESS TRUE
Anton Komlev1e775502025-04-25 16:37:55 +010024# The FetchContent_MakeAvailable() function automatically adds the fetched library
25# directory to the build using add_subdirectory(). However, the TF-M t_cose module
26# defines its own custom target instead of using the default one provided by the
27# remote library.
28# We set the SOURCE_SUBDIR variable to a non-existent directory as a workaround.
29# Related issue: https://gitlab.kitware.com/cmake/cmake/-/issues/26220
30 SOURCE_SUBDIR non-exist-dir
Adam Kulesza4ced6b32022-05-24 19:13:56 +020031)
32
Anton Komlev1e775502025-04-25 16:37:55 +010033include(tfm_t_cose.cmake)
Antonio de Angelis34a0ffd2023-02-16 11:56:46 +000034
shejia01d853fe82021-07-12 20:03:55 +080035############################ t_cose secure #####################################
36
37add_library(tfm_t_cose_s STATIC EXCLUDE_FROM_ALL)
38
39target_link_libraries(tfm_t_cose_s
40 PUBLIC
shejia01d853fe82021-07-12 20:03:55 +080041 tfm_t_cose_defs
Jamie Fox10f08702024-06-21 14:21:34 +010042 PRIVATE
43 tfm_t_cose_common
shejia01d853fe82021-07-12 20:03:55 +080044 psa_interface
David Vincze3de42282022-11-10 16:26:45 +010045 qcbor
Antonio de Angelis8bb98512024-01-16 14:13:36 +000046 platform_s
shejia01d853fe82021-07-12 20:03:55 +080047)
48
Feder Liangd4dbaa92021-09-07 15:34:46 +080049target_compile_options(tfm_t_cose_s
Jamie Fox10f08702024-06-21 14:21:34 +010050 PRIVATE
Feder Liangd4dbaa92021-09-07 15:34:46 +080051 ${COMPILER_CP_FLAG}
Raef Coles19715382020-07-10 09:50:17 +010052)