# Find VisualLeakDetector # # This module defines # VisualLeakDetector_FOUND # VisualLeakDetector_INCLUDE_DIRS # VisualLeakDetector_LIBRARY_DIR # # Copyright (c) 2012 I-maginer # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA, or go to # http://www.gnu.org/copyleft/lesser.txt # # On a new cmake run, we do not need to be verbose IF(VisualLeakDetector_INCLUDE_DIR AND VisualLeakDetector_LIBRARY) SET(VisualLeakDetector_FIND_QUIETLY TRUE) ENDIF() # If VLD_ROOT was defined in the environment, use it. Else, search in registry for install path. IF(NOT VisualLeakDetector_ROOT) IF("$ENV{VLD_ROOT}" STREQUAL "") SET(VisualLeakDetector_ROOT [HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Visual\ Leak\ Detector;InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Visual\ Leak\ Detector;InstallPath]) ELSE() SET(VisualLeakDetector_ROOT $ENV{VLD_ROOT}) ENDIF() ENDIF() if(VisualLeakDetector_ROOT) SET(VisualLeakDetector_INCLUDE_SEARCH_DIRS ${VisualLeakDetector_INCLUDE_SEARCH_DIRS} ${VisualLeakDetector_ROOT}/include ) SET(VisualLeakDetector_LIBRARY_SEARCH_DIRS ${VisualLeakDetector_LIBRARY_SEARCH_DIRS} ${VisualLeakDetector_ROOT}/lib/Win32 ) endif() # log message IF (NOT VisualLeakDetector_FIND_QUIETLY) MESSAGE(STATUS "Checking for VisualLeakDetector library") ENDIF() # Search for header files FIND_PATH(VisualLeakDetector_INCLUDE_DIR vld.h PATHS ${VisualLeakDetector_INCLUDE_SEARCH_DIRS}) # Search for libraries files FIND_PATH(VisualLeakDetector_LIBRARY vld.lib PATHS ${VisualLeakDetector_LIBRARY_SEARCH_DIRS}) # Configure libraries. SET(VisualLeakDetector_INCLUDE_DIRS ${VisualLeakDetector_INCLUDE_DIR} CACHE STRING "Directory containing VisualLeakDetector header files") SET(VisualLeakDetector_LIBRARY_DIR ${VisualLeakDetector_LIBRARY} CACHE STRING "VisualLeakDetector libraries files") # Hide those variables in GUI SET(VisualLeakDetector_INCLUDE_DIR ${VisualLeakDetector_INCLUDE_DIR} CACHE INTERNAL "") SET(VisualLeakDetector_LIBRARY ${VisualLeakDetector_LIBRARY} CACHE INTERNAL "") IF(VisualLeakDetector_INCLUDE_DIR AND VisualLeakDetector_LIBRARY) SET(VisualLeakDetector_FOUND TRUE) ENDIF() # log find result IF(VisualLeakDetector_FOUND) IF(NOT VisualLeakDetector_FIND_QUIETLY) MESSAGE(STATUS " library dir: ${VisualLeakDetector_LIBRARY_DIR}") MESSAGE(STATUS " includes: ${VisualLeakDetector_INCLUDE_DIRS}") ENDIF() ELSE(VisualLeakDetector_FOUND) IF(NOT VisualLeakDetector_LIBRARY_DIR) MESSAGE(STATUS, "VisualLeakDetector library could not be found.") ENDIF() IF(NOT VisualLeakDetector_INCLUDE_DIRS) MESSAGE(STATUS "VisualLeakDetector include files could not be found.") ENDIF() ENDIF(VisualLeakDetector_FOUND)