1# 2# Copyright (c) 2020 Nordic Semiconductor ASA 3# 4# SPDX-License-Identifier: Apache-2.0 5# 6 7cmake_minimum_required(VERSION 3.13.1) 8 9set_property(GLOBAL PROPERTY CSTD c11) # To avoid issues with c99 and -Wpedantic 10 11find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) 12project(test1_unit_tests) 13include(../../cmake/test_template.cmake) 14 15FILE(GLOB zcbor_sources ../../../src/*.c) 16zephyr_library_named(zcbor) 17zephyr_library_sources(${zcbor_sources}) 18 19target_include_directories(app PRIVATE ../../../include) 20target_include_directories(zcbor PRIVATE ../../../include) 21 22target_link_libraries(app PRIVATE zcbor) 23 24target_compile_options(zcbor PRIVATE -Wpedantic -Wconversion -Wall -Wextra -Wdouble-promotion) 25 26file(READ ${CMAKE_CURRENT_LIST_DIR}/../../../zcbor/VERSION ZCBOR_VERSION_STR) 27string(REPLACE "." ";" ZCBOR_VERSION_SPLIT ${ZCBOR_VERSION_STR}) 28list(GET ZCBOR_VERSION_SPLIT 0 ZCBOR_VERSION_MAJOR) 29list(GET ZCBOR_VERSION_SPLIT 1 ZCBOR_VERSION_MINOR) 30list(GET ZCBOR_VERSION_SPLIT 2 ZCBOR_VERSION_BUGFIX) 31math(EXPR ZCBOR_VERSION "(${ZCBOR_VERSION_MAJOR} << 24) + (${ZCBOR_VERSION_MINOR} << 16) + (${ZCBOR_VERSION_BUGFIX} << 8)") 32 33zephyr_compile_definitions( 34 ZCBOR_STOP_ON_ERROR 35 TEST_ZCBOR_VERSION_STR="${ZCBOR_VERSION_STR}" 36 TEST_ZCBOR_VERSION=${ZCBOR_VERSION} 37 TEST_ZCBOR_VERSION_MAJOR=${ZCBOR_VERSION_MAJOR} 38 TEST_ZCBOR_VERSION_MINOR=${ZCBOR_VERSION_MINOR} 39 TEST_ZCBOR_VERSION_BUGFIX=${ZCBOR_VERSION_BUGFIX}) 40