TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags
[wireshark-sm.git] / cmake / modules / FindVLD.cmake
blobcc9cdd736bce7f9499b2844be69b595ba63d1624
2 # - Find Visual Leak Detector
4 #  VLD_LINK_FLAGS - MSVC linker flags that enable VLD
5 #  VLD_FILES - files that should be copied to dll output directory
6 #  VLD_VALID - TRUE if Visual Leak Detector was found
8 set(_PF86 "PROGRAMFILES(x86)")
9 set(_vld_arch Win64)
10 set(_vld_dll vld_x64.dll)
11 set(_vld_pdb vld_x64.pdb)
12 if(WIRESHARK_TARGET_PLATFORM MATCHES "win32")
13         set(_vld_arch Win32)
14         set(_vld_dll vld_x86.dll)
15         set(_vld_pdb vld_x86.pdb)
16 endif()
18 find_library(VLD_LIBRARY
19         NAMES
20                 vld
21         HINTS
22                 "$ENV{PROGRAMFILES}/Visual Leak Detector/lib/${_vld_arch}"
23                 "$ENV{${_PF86}}/Visual Leak Detector/lib/${_vld_arch}"
24                 "$ENV{PROGRAMW6432}/Visual Leak Detector/lib/${_vld_arch}"
27 function(find_vld_file _vld_file _filename)
28         find_file(${_vld_file}
29                 NAMES
30                         ${_filename}
31                 HINTS
32                         "$ENV{PROGRAMFILES}/Visual Leak Detector/bin/${_vld_arch}"
33                         "$ENV{${_PF86}}/Visual Leak Detector/bin/${_vld_arch}"
34                         "$ENV{PROGRAMW6432}/Visual Leak Detector/bin/${_vld_arch}"
35         )
36         if(${${_vld_file}} STREQUAL "${_vld_file}-NOTFOUND")
37                 set(${_vld_file} "" PARENT_SCOPE)
38         endif()
39 endfunction()
41 find_vld_file(VLD_DLL ${_vld_dll})
42 find_vld_file(VLD_DBGHELP_DLL "dbghelp.dll")
43 find_vld_file(VLD_MANIFEST "Microsoft.DTfW.DHL.manifest")
44 find_vld_file(VLD_PDB ${_vld_pdb})
46 #library, dlls and manifest are mandatory, while pdb is optional
47 IF(VLD_LIBRARY AND (EXISTS ${VLD_DLL}) AND (EXISTS ${VLD_DBGHELP_DLL}) AND (EXISTS ${VLD_MANIFEST}))
48         # Link against VLD library and force it to be linked by referencing symbol
49         # Adding VLD_LINK_FLAGS to linker flags enables Visual Leak Detector
50         set(VLD_LINK_FLAGS "\"${VLD_LIBRARY}\" /include:__imp_?g_vld@@3VVisualLeakDetector@@A")
51         file(GLOB VLD_FILES
52                 "${VLD_DLL}"
53                 "${VLD_DBGHELP_DLL}"
54                 "${VLD_MANIFEST}"
55                 "${VLD_PDB}"
56         )
57         set(VLD_FOUND TRUE)
58 else()
59         set(VLD_LINK_FLAGS)
60         set(VLD_FILES)
61         set(VLD_FOUND FALSE)
62 endif()