From 6f564edc3baed8cf1c4bbd0467c29dfca3a120b6 Mon Sep 17 00:00:00 2001 From: Mathias Preiner Date: Tue, 11 Sep 2018 10:54:20 -0700 Subject: [PATCH] cmake: Add module finder for Valgrind. --- CMakeLists.txt | 3 ++- cmake/FindValgrind.cmake | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 cmake/FindValgrind.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b4e567769..8e2a61c1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -456,7 +456,8 @@ if(ENABLE_STATISTICS) endif() if(ENABLE_VALGRIND) - #TODO check if valgrind available + find_package(Valgrind REQUIRED) + libcvc4_include_directories(${Valgrind_INCLUDE_DIR}) add_definitions(-DCVC4_VALGRIND) endif() diff --git a/cmake/FindValgrind.cmake b/cmake/FindValgrind.cmake new file mode 100644 index 000000000..4c5cb1d28 --- /dev/null +++ b/cmake/FindValgrind.cmake @@ -0,0 +1,11 @@ +# Find Valgrind +# Valgrind_FOUND - system has Valgrind lib +# Valgrind_INCLUDE_DIR - the Valgrind include directory +# +# Note: We only require the valgrind/memcheck.h header, so we don't check if +# the valgrind executable is installed. + +find_path(Valgrind_INCLUDE_DIR NAMES valgrind/memcheck.h) + +find_package_handle_standard_args(Valgrind REQUIRED_VARS Valgrind_INCLUDE_DIR) +mark_as_advanced(Valgrind_INCLUDE_DIR) -- 2.30.2