From 170236dce5e71dd72ea730716510637f97c99f0e Mon Sep 17 00:00:00 2001 From: Tuomo Kriikkula Date: Tue, 25 Jun 2024 15:01:05 +0300 Subject: [PATCH] Find Valgrind only on Unix --- CMakeLists.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05fba1a..4f79a4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,8 +189,18 @@ option(UMB_INCLUDE_META "include meta/reflection C++ templates" ON) option(UMB_RUN_CLANG_FORMAT "run clang-format on generated C++ files" ON) if (BUILD_TESTS) - find_program(MEMORYCHECK_COMMAND valgrind) - set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full --track-origins=yes --error-exitcode=1") + # TODO: make this optional even on Unix builds? + if (UNIX) + find_program( + MEMORYCHECK_COMMAND + NAMES + valgrind + HINTS + $ENV{UMB_VALGRIND_BIN} # Used in GitHub Actions. + REQUIRED + ) + set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full --track-origins=yes --error-exitcode=1") + endif () include(CTest) enable_testing() add_subdirectory(tests)