summaryrefslogtreecommitdiffstats
path: root/tests/deckard/contrib/libswrap/cmake/Modules/AddCMockaTest.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
commit3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch)
treef87bd4a126b3a843858eb447e8fd5893c3ee3882 /tests/deckard/contrib/libswrap/cmake/Modules/AddCMockaTest.cmake
parentInitial commit. (diff)
downloadknot-resolver-upstream.tar.xz
knot-resolver-upstream.zip
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/deckard/contrib/libswrap/cmake/Modules/AddCMockaTest.cmake')
-rw-r--r--tests/deckard/contrib/libswrap/cmake/Modules/AddCMockaTest.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/deckard/contrib/libswrap/cmake/Modules/AddCMockaTest.cmake b/tests/deckard/contrib/libswrap/cmake/Modules/AddCMockaTest.cmake
new file mode 100644
index 0000000..b2d1ca8
--- /dev/null
+++ b/tests/deckard/contrib/libswrap/cmake/Modules/AddCMockaTest.cmake
@@ -0,0 +1,23 @@
+# - ADD_CHECK_TEST(test_name test_source linklib1 ... linklibN)
+
+# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
+# Copyright (c) 2007-2010 Andreas Schneider <asn@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+enable_testing()
+include(CTest)
+
+if(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
+ set(CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags")
+ set(CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
+ set(CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
+ set(CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
+endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
+
+function (ADD_CMOCKA_TEST _testName _testSource)
+ add_executable(${_testName} ${_testSource})
+ target_link_libraries(${_testName} ${ARGN})
+ add_test(${_testName} ${CMAKE_CURRENT_BINARY_DIR}/${_testName})
+endfunction (ADD_CMOCKA_TEST)