Allow the use of Visual Leak Detector

See the small feature [[Small features/Visual_Leak_Detector]] in CGAL
developers wiki:
  https://cgal.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/Visual_Leak_Detector

See also:
  http://vld.codeplex.com/
This commit is contained in:
Laurent Rineau 2013-08-26 15:28:59 +02:00
parent fbc465f547
commit ea6e24200c
3 changed files with 54 additions and 1 deletions

View File

@ -50,6 +50,15 @@ if( NOT CGAL_COMMON_FILE_INCLUDED )
endif()
endif()
hide_variable(CMAKE_UNAME)
# Optionally setup the Visual Leak Detector
include(CGAL_SetupVLD)
CGAL_SetupVLD()
if(VLD_FOUND)
message(STATUS "Visual Leak Detector (VLD) is enabled.")
else()
message(STATUS "Visual Leak Detector (VLD) is not found.")
endif()
endif()
set(CMAKE_COLORMAKEFILE ON)

View File

@ -0,0 +1,37 @@
function(CGAL_setupVLD)
if(DEFINED ENV{CGAL_ENABLE_VLD} AND NOT DEFINED CGAL_ENABLE_VLD)
set(CGAL_ENABLE_VLD $ENV{CGAL_ENABLE_VLD})
endif()
if(CGAL_ENABLE_VLD)
find_path(VLD_INCLUDE_DIR vld.h
HINTS $ENV{VLD_INCLUDE_DIR}
$ENV{VLD_HOME}/include
$ENV{VLD_HOME}
DOC "Path of the Visual Leak Detector header vld.h"
)
find_library(VLD_LIBRARY
NAMES vld-x86 vld
HINTS ${VLD_LIBRARY_DIR}
$ENV{VLD_LIBRARY_DIR}
$ENV{VLD_HOME}/lib
$ENV{VLD_HOME}
${VLD_INCLUDE_DIR}
${VLD_INCLUDE_DIR}/lib
DOC "Path of the Visual Leak Detector library vld.lib"
)
if(VLD_LIBRARY)
get_filename_component(VLD_LIBRARY_DIR "${VLD_LIBRARY}" PATH CACHE)
endif()
if(VLD_INCLUDE_DIR AND VLD_LIBRARY_DIR)
set(VLD_FOUND 1 PARENT_SCOPE)
include_directories(${VLD_INCLUDE_DIR})
link_directories(${VLD_LIBRARY_DIR})
add_definitions(-DCGAL_ENABLE_VLD)
endif()
endif(CGAL_ENABLE_VLD)
endfunction()

View File

@ -1,4 +1,4 @@
// Copyright (c) 1997-2010
// Copyright (c) 1997-2013
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
@ -23,6 +23,7 @@
// Author(s) : Wieger Wesselink
// Michael Hoffmann <hoffmann@inf.ethz.ch>
// Sylvain Pion
// Laurent Rineau
#ifndef CGAL_CONFIG_H
#define CGAL_CONFIG_H
@ -43,6 +44,12 @@
# error The test-suite needs no NDEBUG defined
#endif // CGAL_TEST_SUITE and NDEBUG
// See [[Small features/Visual_Leak_Detector]] in CGAL developers wiki
// See also: http://vld.codeplex.com/
#if defined(CGAL_ENABLE_VLD)
# include <vld.h>
#endif // CGAL_ENABLE_VLD
// Workaround to the following bug:
// https://bugreports.qt.nokia.com/browse/QTBUG-22829
#ifdef Q_MOC_RUN