Update to WinSparkle 0.5.3.
[metze/wireshark/wip.git] / cmake / modules / FindWinSparkle.cmake
1 #
2 # - Find WinSparkle
3 # Find the native WinSparkle includes and library
4 #
5 #  WINSPARKLE_INCLUDE_DIRS - where to find WinSparkle.h, etc.
6 #  WINSPARKLE_LIBRARIES    - List of libraries when using WinSparkle.
7 #  WINSPARKLE_FOUND        - True if WinSparkle found.
8 #  WINSPARKLE_DLL_DIR      - (Windows) Path to the WinSparkle DLL.
9 #  WINSPARKLE_DLL          - (Windows) Name of the WinSparkle DLL.
10
11
12 IF (WINSPARKLE_INCLUDE_DIRS)
13   # Already in cache, be silent
14   SET(WINSPARKLE_FIND_QUIETLY TRUE)
15 ENDIF (WINSPARKLE_INCLUDE_DIRS)
16
17 INCLUDE(FindWSWinLibs)
18 FindWSWinLibs("WinSparkle.*" "WINSPARKLE_HINTS")
19
20 # The 64-bit wpcap.lib is under /x64/Release
21 set ( _RELEASE_SUBDIR "Release" )
22 if( WIN32 AND "${WIRESHARK_TARGET_PLATFORM}" STREQUAL "win64" )
23   set ( _RELEASE_SUBDIR "x64/Release" )
24 endif()
25
26 FIND_PATH(WINSPARKLE_INCLUDE_DIR winsparkle.h HINTS "${WINSPARKLE_HINTS}/include" )
27
28 FIND_LIBRARY(WINSPARKLE_LIBRARY NAMES WinSparkle HINTS "${WINSPARKLE_HINTS}/${_RELEASE_SUBDIR}" )
29
30 # handle the QUIETLY and REQUIRED arguments and set WINSPARKLE_FOUND to TRUE if
31 # all listed variables are TRUE
32 INCLUDE(FindPackageHandleStandardArgs)
33 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WINSPARKLE DEFAULT_MSG WINSPARKLE_LIBRARY WINSPARKLE_INCLUDE_DIR)
34
35 IF(WINSPARKLE_FOUND)
36   SET(WINSPARKLE_LIBRARIES ${WINSPARKLE_LIBRARY} )
37   SET(WINSPARKLE_INCLUDE_DIRS ${WINSPARKLE_INCLUDE_DIR} )
38   if (WIN32)
39     set ( WINSPARKLE_DLL_DIR "${WINSPARKLE_HINTS}/${_RELEASE_SUBDIR}"
40       CACHE PATH "Path to the WinSparkle DLL"
41     )
42     file( GLOB _winsparkle_dll RELATIVE "${WINSPARKLE_DLL_DIR}"
43       "${WINSPARKLE_DLL_DIR}/WinSparkle.dll"
44     )
45     set ( WINSPARKLE_DLL ${_winsparkle_dll}
46       # We're storing filenames only. Should we use STRING instead?
47       CACHE FILEPATH "WinSparkle DLL file name"
48     )
49     mark_as_advanced( WINSPARKLE_DLL_DIR WINSPARKLE_DLL )
50   endif()
51 ELSE(WINSPARKLE_FOUND)
52   SET(WINSPARKLE_LIBRARIES )
53   SET(WINSPARKLE_INCLUDE_DIRS )
54   SET(WINSPARKLE_DLL_DIR )
55   SET(WINSPARKLE_DLL )
56 ENDIF(WINSPARKLE_FOUND)
57
58 MARK_AS_ADVANCED( WINSPARKLE_LIBRARIES WINSPARKLE_INCLUDE_DIRS )