Skip to content

Commit c59282a

Browse files
committed
Add info when we found Valgrind + don't failed when we don't find
command
1 parent d442ed7 commit c59282a

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ if(UNIX AND NOT APPLE)
141141
endif()
142142

143143
find_program(MEMORYCHECK_COMMAND valgrind)
144+
if(NOT "${MEMORYCHECK_COMMAND}" STREQUAL "MEMORYCHECK_COMMAND-NOTFOUND")
145+
if (NOT WIN32)
146+
MESSAGE(STATUS "Valgrind found! Tests based on valgrind must be executed.")
147+
endif()
148+
endif()
149+
144150
# Set our extra command options for valgrind
145151
# TODO: we need to come up with a better way to suppress "possibly lost" errors.
146152
# Suppression file doesn't work because there is a ton of mangled names that won't remain stable.

tests/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ function(add_acceptance_tests TEST_NAME)
2020
)
2121

2222
if (NOT WIN32)
23-
# Add valgrind test
24-
add_valgrind_test(
25-
${NAME_WITH_PREFIX} $<TARGET_FILE:${TARGET_NAME}>
26-
${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}
27-
)
23+
if (COMMAND add_valgrind_test)
24+
# Add valgrind test
25+
add_valgrind_test(
26+
${NAME_WITH_PREFIX} $<TARGET_FILE:${TARGET_NAME}>
27+
${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}
28+
)
29+
else()
30+
MESSAGE(STATUS "add_valgrind_test is defined in the top level of CXX-Qt. It will not executed")
31+
endif()
2832
endif()
2933
endfunction()
3034

0 commit comments

Comments
 (0)