aboutsummaryrefslogtreecommitdiff
path: root/contrib/libcbor/test/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libcbor/test/CMakeLists.txt')
-rw-r--r--contrib/libcbor/test/CMakeLists.txt14
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/libcbor/test/CMakeLists.txt b/contrib/libcbor/test/CMakeLists.txt
index 67ea13dfc44c..9721fd03a166 100644
--- a/contrib/libcbor/test/CMakeLists.txt
+++ b/contrib/libcbor/test/CMakeLists.txt
@@ -1,20 +1,22 @@
file(GLOB TESTS "*_test.c")
-if(NOT CBOR_CUSTOM_ALLOC)
- # Memory allocation test requires custom allocator support to instrument it.
- list(REMOVE_ITEM TESTS ${CMAKE_CURRENT_SOURCE_DIR}/memory_allocation_test.c)
-endif(NOT CBOR_CUSTOM_ALLOC)
-
find_package(CMocka REQUIRED)
message(STATUS "CMocka vars: ${CMOCKA_LIBRARIES} ${CMOCKA_INCLUDE_DIR}")
+find_library(MATH_LIBRARY m)
+
+CHECK_INCLUDE_FILE("execinfo.h" HAS_EXECINFO)
+
foreach (TEST ${TESTS})
string(REGEX REPLACE ".*/([^/]+).c" "\\1" NAME ${TEST})
message("Adding test ${NAME}")
- add_executable(${NAME} "${NAME}.c" assertions.c stream_expectations.c)
+ add_executable(${NAME} "${NAME}.c" assertions.c stream_expectations.c test_allocator.c)
target_link_libraries(${NAME} ${CMOCKA_LIBRARIES})
target_link_libraries(${NAME} cbor)
+ if(MATH_LIBRARY)
+ target_link_libraries(${NAME} ${MATH_LIBRARY})
+ endif()
target_include_directories(${NAME} PUBLIC ${CMOCKA_INCLUDE_DIR})
# See https://stackoverflow.com/a/10824578/499521
ADD_TEST(ctest_build_test_${NAME}