Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
test memcheck builds with valgrind
[simgrid.git] / tools / cmake / Modules / FindValgrind.cmake
1 find_program(VALGRIND_EXE
2   NAME valgrind
3   PATH_SUFFIXES bin/
4   PATHS
5   /opt
6   /opt/local
7   /opt/csw
8   /sw
9   /usr
10   )
11 mark_as_advanced(VALGRIND_EXE)
12
13 if(enable_memcheck)
14   if (NOT VALGRIND_EXE MATCHES "NOTFOUND")
15     execute_process(COMMAND ${VALGRIND_EXE} --version  OUTPUT_VARIABLE "VALGRIND_VERSION")
16     message(STATUS "Valgrind version: ${VALGRIND_VERSION}")
17
18     set(TESH_WRAPPER ${CMAKE_HOME_DIRECTORY}/tools/cmake/scripts/my_valgrind.pl)
19     set(TESH_WRAPPER ${TESH_WRAPPER}\ --trace-children=yes\ --trace-children-skip=/usr/bin/*,/bin/*\ --leak-check=full\ --show-reachable=yes\ --track-origins=no\ --read-var-info=no\ --num-callers=20\ --suppressions=${CMAKE_HOME_DIRECTORY}/tools/simgrid.supp\ )
20     if(enable_memcheck_xml)
21       SET(TESH_WRAPPER ${TESH_WRAPPER}\ --xml=yes\ --xml-file=memcheck_test_%p.memcheck\ --child-silent-after-fork=yes\ )
22     endif()
23
24 #    message(STATUS "tesh wrapper: ${TESH_WRAPPER}")
25
26     mark_as_advanced(TESH_WRAPPER)
27   else()
28     set(enable_memcheck false)
29     message(STATUS "Error: Command valgrind not found --> enable_memcheck autoset to false.")
30   endif()
31 endif()