diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-11-07 15:27:42 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-11-07 15:27:42 +0100 |
commit | c6119654921decf0412149484b546dfc4902346c (patch) | |
tree | 5a4d8c3f0e37ebb9593258a0e01277a3fcbfaace | |
parent | ff3a97de55176ae600124695ae9aa815b5ff2f18 (diff) | |
download | sink-c6119654921decf0412149484b546dfc4902346c.tar.gz sink-c6119654921decf0412149484b546dfc4902346c.zip |
Require valgrind when enabling memcheck
-rw-r--r-- | CMakeLists.txt | 9 | ||||
-rw-r--r-- | tests/SinkTest.cmake | 9 |
2 files changed, 11 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cef0c3c..5ee08ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -36,8 +36,13 @@ find_package(FlatBuffers REQUIRED 1.4.0) | |||
36 | find_package(KAsync REQUIRED 0.1.2) | 36 | find_package(KAsync REQUIRED 0.1.2) |
37 | find_package(LMDB REQUIRED 0.9) | 37 | find_package(LMDB REQUIRED 0.9) |
38 | 38 | ||
39 | find_program(MEMORYCHECK_COMMAND valgrind) | 39 | if (${ENABLE_MEMCHECK}) |
40 | set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full") | 40 | find_program(MEMORYCHECK_COMMAND valgrind) |
41 | if(NOT MEMORYCHECK_COMMAND) | ||
42 | message(FATAL_ERROR "valgrind not found!") | ||
43 | endif() | ||
44 | set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full") | ||
45 | endif() | ||
41 | 46 | ||
42 | #Clang-format support | 47 | #Clang-format support |
43 | add_custom_command( | 48 | add_custom_command( |
diff --git a/tests/SinkTest.cmake b/tests/SinkTest.cmake index 4eb8f43..d0cda8d 100644 --- a/tests/SinkTest.cmake +++ b/tests/SinkTest.cmake | |||
@@ -3,12 +3,11 @@ | |||
3 | function(add_memcheck_test name binary) | 3 | function(add_memcheck_test name binary) |
4 | if (${ENABLE_MEMCHECK}) | 4 | if (${ENABLE_MEMCHECK}) |
5 | set(memcheck_command "${MEMORYCHECK_COMMAND} ${MEMORYCHECK_COMMAND_OPTIONS}") | 5 | set(memcheck_command "${MEMORYCHECK_COMMAND} ${MEMORYCHECK_COMMAND_OPTIONS}") |
6 | if (NOT ${memcheck_command}) | 6 | if (NOT memcheck_command) |
7 | message("MEMORYCHECK_COMMAND not defined.") | 7 | message(FATAL_ERROR "memcheck_command not defined. ${memcheck_command}") |
8 | else() | ||
9 | separate_arguments(memcheck_command) | ||
10 | add_test(memcheck_${name} ${memcheck_command} ./${binary} ${ARGN}) | ||
11 | endif() | 8 | endif() |
9 | separate_arguments(memcheck_command) | ||
10 | add_test(memcheck_${name} ${memcheck_command} ./${binary} ${ARGN}) | ||
12 | endif() | 11 | endif() |
13 | endfunction(add_memcheck_test) | 12 | endfunction(add_memcheck_test) |
14 | 13 | ||