blob: 37bfc39b5a58334c3b90dab3d6c4216281f10930 [file] [log] [blame]
Dávid Vincze306cfc22022-12-19 20:02:39 +01001cmake_minimum_required(VERSION 3.15)
2
3# Validate value of BUILD_QCBOR_TEST config option
4if ((NOT BUILD_QCBOR_TEST STREQUAL "LIB") AND (NOT BUILD_QCBOR_TEST STREQUAL "APP"))
5 message(FATAL_ERROR "QCBOR | Invalid Config: BUILD_QCBOR_TEST=${BUILD_QCBOR_TEST}")
6endif()
7
8add_library(qcbor_test STATIC)
9
10target_sources(qcbor_test
11 PRIVATE
12 float_tests.c
13 half_to_double_from_rfc7049.c
14 qcbor_decode_tests.c
15 qcbor_encode_tests.c
16 run_tests.c
17 UsefulBuf_Tests.c
18)
19
20target_include_directories(qcbor_test
21 PUBLIC
22 .
23 PRIVATE
24 ../inc
25)
26
27target_link_libraries(qcbor_test
28 PRIVATE
29 qcbor
30 # The math library is needed for floating-point support.
31 # To avoid need for it #define QCBOR_DISABLE_FLOAT_HW_USE
32 m
33)
34
35if (BUILD_QCBOR_TEST STREQUAL "APP")
36 add_executable(qcbortest)
37
38 target_sources(qcbortest
39 PRIVATE
40 ../cmd_line_main.c
41 ../example.c
42 ../ub-example.c
43 )
44
45 target_include_directories(qcbortest
46 PRIVATE
47 ../
48 )
49
50 target_link_libraries(qcbortest
51 PRIVATE
52 qcbor
53 qcbor_test
54 )
55endif()