cmake: Add module finder for Valgrind.
authorMathias Preiner <mathias.preiner@gmail.com>
Tue, 11 Sep 2018 17:54:20 +0000 (10:54 -0700)
committerMathias Preiner <mathias.preiner@gmail.com>
Sat, 22 Sep 2018 23:30:59 +0000 (16:30 -0700)
CMakeLists.txt
cmake/FindValgrind.cmake [new file with mode: 0644]

index b4e56776931ccba4f0a1ba4556d0f719d8efc0f1..8e2a61c1fc79132e998233fc687f0342f09f54c0 100644 (file)
@@ -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 (file)
index 0000000..4c5cb1d
--- /dev/null
@@ -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)