Harrison Mutai | 762d494 | 2025-05-06 13:06:41 +0000 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2025, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
| 7 | cmake_minimum_required(VERSION 3.15) |
| 8 | |
| 9 | project(libeventlog VERSION 0.9 LANGUAGES C CXX ASM) |
| 10 | |
| 11 | set(CMAKE_C_STANDARD_REQUIRED TRUE) |
| 12 | set(CMAKE_C_EXTENSIONS TRUE) |
| 13 | |
| 14 | add_library(cxx_compiler_flags INTERFACE) |
| 15 | target_compile_features(cxx_compiler_flags INTERFACE cxx_std_11) |
| 16 | |
| 17 | SET(TARGET_GROUP release CACHE STRING "Specify the Build Target [\"release\" by default]") |
| 18 | |
| 19 | if(HASH_ALGORITHM STREQUAL "SHA512") |
| 20 | add_compile_definitions(TPM_ALG_ID=TPM_ALG_SHA512) |
| 21 | add_compile_definitions(TCG_DIGEST_SIZE=64U) |
| 22 | elseif(HASH_ALGORITHM STREQUAL "SHA384") |
| 23 | add_compile_definitions(TPM_ALG_ID=TPM_ALG_SHA384) |
| 24 | add_compile_definitions(TCG_DIGEST_SIZE=48U) |
| 25 | else() |
| 26 | add_compile_definitions(TPM_ALG_ID=TPM_ALG_SHA256) |
| 27 | add_compile_definitions(TCG_DIGEST_SIZE=32U) |
| 28 | endif() |
| 29 | |
| 30 | add_library(eventlog STATIC |
| 31 | ${PROJECT_SOURCE_DIR}/src/event_log.c |
| 32 | ${PROJECT_SOURCE_DIR}/src/event_print.c |
| 33 | ) |
| 34 | |
| 35 | target_include_directories(eventlog PUBLIC ${CMAKE_SOURCE_DIR}/include) |
| 36 | target_link_libraries(eventlog PUBLIC cxx_compiler_flags) |