3 # Due to the layout of the Wireshark Win support libs,
4 # CMake needs some support to find them
6 # The function is passed the directory name to search for and the variable
7 # to set in the callers scope.
9 function( FindWSWinLibs _WS_LIB_SEARCH_PATH _LIB_HINT_VAR )
12 set( _PROJECT_LIB_DIR ${ARGN} )
14 if( DEFINED ENV{WIRESHARK_LIB_DIR} )
15 # The buildbots set WIRESHARK_LIB_DIR but not WIRESHARK_BASE_DIR.
16 file( TO_CMAKE_PATH "$ENV{WIRESHARK_LIB_DIR}" _PROJECT_LIB_DIR )
18 file( TO_CMAKE_PATH "$ENV{WIRESHARK_BASE_DIR}" _WS_BASE_DIR )
19 set( _PROJECT_LIB_DIR "${_WS_BASE_DIR}/wireshark-${WIRESHARK_TARGET_PLATFORM}-libs" )
23 file( GLOB _SUBDIR "${_PROJECT_LIB_DIR}/*" )
24 # We might be able to use $ENV{VSCMD_ARG_TGT_ARCH} here.
26 foreach( _DIR ${_SUBDIR} )
27 if( IS_DIRECTORY ${_DIR} )
28 if( "${_DIR}" MATCHES ".*/${_WS_LIB_SEARCH_PATH}" )
29 set(_vcpkg_dir "${_DIR}/installed/${WIRESHARK_TARGET_PLATFORM}-windows")
30 if( IS_DIRECTORY "${_vcpkg_dir}")
31 set( ${_LIB_HINT_VAR} ${_vcpkg_dir} PARENT_SCOPE )
33 set( ${_LIB_HINT_VAR} ${_DIR} PARENT_SCOPE )
42 function(AddWSWinDLL _PKG_NAME _PKG_HINTS _DLL_GLOB)
43 if(USE_REPOSITORY AND ${_PKG_NAME}_FOUND)
44 string(TOUPPER ${_PKG_NAME} _PKG_VAR)
45 set ( ${_PKG_VAR}_DLL_DIR "${${_PKG_HINTS}}/bin"
46 CACHE PATH "Path to ${_PKG_NAME} DLL"
48 file( GLOB _pkg_dll RELATIVE "${${_PKG_VAR}_DLL_DIR}"
49 "${${_PKG_VAR}_DLL_DIR}/${_DLL_GLOB}.dll"
51 set ( ${_PKG_VAR}_DLL ${_pkg_dll}
52 CACHE STRING "${_PKG_NAME} DLL file name"
54 file( GLOB _pkg_pdb RELATIVE "${${_PKG_VAR}_DLL_DIR}"
55 "${${_PKG_VAR}_DLL_DIR}/${_DLL_GLOB}.pdb"
57 set ( ${_PKG_VAR}_PDB ${_pkg_pdb}
58 CACHE STRING "${_PKG_NAME} PDB file name"
60 mark_as_advanced( ${_PKG_VAR}_DLL_DIR ${_PKG_VAR}_DLL ${_PKG_VAR}_PDB )
62 set( ${_PKG_VAR}_DLL_DIR )
63 set( ${_PKG_VAR}_DLL )
68 function(AddWSWinDLLS _PKG_NAME _PKG_HINTS) # ...DLL globs
69 if(USE_REPOSITORY AND ${_PKG_NAME}_FOUND)
70 string(TOUPPER ${_PKG_NAME} _PKG_VAR)
71 set ( ${_PKG_VAR}_DLL_DIR "${${_PKG_HINTS}}/bin"
72 CACHE PATH "Path to ${_PKG_NAME} DLLs"
77 foreach(_dll_glob ${ARGN})
78 file( GLOB _pkg_dll RELATIVE "${${_PKG_VAR}_DLL_DIR}"
79 "${${_PKG_VAR}_DLL_DIR}/${_dll_glob}.dll"
81 list(APPEND _pkg_dlls "${_pkg_dll}")
82 file( GLOB _pkg_pdb RELATIVE "${${_PKG_VAR}_DLL_DIR}"
83 "${${_PKG_VAR}_DLL_DIR}/${_dll_glob}.pdb"
85 list(APPEND _pkg_pdbs "${_pkg_pdb}")
88 set ( ${_PKG_VAR}_DLLS ${_pkg_dlls}
89 CACHE FILEPATH "${_PKG_NAME} DLL list"
91 set ( ${_PKG_VAR}_PDBS ${_pkg_pdbs}
92 CACHE FILEPATH "${_PKG_NAME} PDB list"
95 mark_as_advanced( ${_PKG_VAR}_DLL_DIR ${_PKG_VAR}_DLLS ${_PKG_VAR}_PDBS )
97 set( ${_PKG_VAR}_DLL_DIR )
98 set( ${_PKG_VAR}_DLLS )
99 set( ${_PKG_VAR}_PDBS )