1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
Description: Use idiomatic CMake to control testsuite execution.
Rather than creating and relying upon a WITH_TESTS variable in the top-level
CMakeLists.txt file, instead make use of the BUILD_TESTING variable defined
by the included CTest module. Also remove the enable_testing() command
invocation in CMakeLists.txt and instead rely on the one in the CTest module
which gets run whenever the BUILD_TESTING variable is not set to OFF.
Author: Plasma (David Paul) <davidpaul@librem.one>
Bug-Debian: https://bugs.debian.org/1064018
Forwarded: no
Last-Update: 2024-02-15
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: libcbor-0.10.2/CMakeLists.txt
===================================================================
--- libcbor-0.10.2.orig/CMakeLists.txt
+++ libcbor-0.10.2/CMakeLists.txt
@@ -29,11 +29,6 @@ option(CBOR_PRETTY_PRINTER "Include a pr
set(CBOR_BUFFER_GROWTH "2" CACHE STRING "Factor for buffer growth & shrinking")
set(CBOR_MAX_STACK_SIZE "2048" CACHE STRING "maximum size for decoding context stack")
-option(WITH_TESTS "[TEST] Build unit tests (requires CMocka)" OFF)
-if(WITH_TESTS)
- add_definitions(-DWITH_TESTS)
-endif(WITH_TESTS)
-
option(WITH_EXAMPLES "Build examples" ON)
option(HUGE_FUZZ "[TEST] Fuzz through 8GB of data in the test. Do not use with memory instrumentation!" OFF)
@@ -97,8 +92,6 @@ else()
add_definitions(-DEIGHT_BYTE_SIZE_T)
endif()
-enable_testing()
-
set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
set(MEMORYCHECK_COMMAND_OPTIONS "--tool=memcheck --track-origins=yes --leak-check=full --error-exitcode=1")
@@ -168,12 +161,12 @@ if(use_lto)
set_property(DIRECTORY src PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif(use_lto)
-if (WITH_TESTS)
+if (BUILD_TESTING)
add_subdirectory(test)
if(use_lto)
set_property(DIRECTORY test PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif(use_lto)
-endif (WITH_TESTS)
+endif (BUILD_TESTING)
if (WITH_EXAMPLES)
add_subdirectory(examples)
|