3 # Find the native SMI includes and library
5 # SMI_INCLUDE_DIRS - where to find smi.h, etc.
6 # SMI_LIBRARIES - List of libraries when using smi.
7 # SMI_FOUND - True if smi found.
8 # SMI_DLL_DIR - (Windows) Path to the SMI DLL.
9 # SMI_DLL - (Windows) Name of the SMI DLL.
10 # SMI_SHARE_DIR - (Windows) Path to the SMI MIBs.
14 # Already in cache, be silent
15 SET(SMI_FIND_QUIETLY TRUE)
16 ENDIF (SMI_INCLUDE_DIR)
18 INCLUDE(FindWSWinLibs)
19 FindWSWinLibs("libsmi-.*" "SMI_HINTS")
21 FIND_PATH(SMI_INCLUDE_DIR smi.h HINTS "${SMI_HINTS}/include" )
24 SET(SMI_NAMES libsmi-2)
26 SET(SMI_NAMES smi libsmi-2)
28 FIND_LIBRARY(SMI_LIBRARY NAMES ${SMI_NAMES} HINTS "${SMI_HINTS}/lib" )
30 # handle the QUIETLY and REQUIRED arguments and set SMI_FOUND to TRUE if
31 # all listed variables are TRUE
32 INCLUDE(FindPackageHandleStandardArgs)
33 FIND_PACKAGE_HANDLE_STANDARD_ARGS(SMI DEFAULT_MSG SMI_LIBRARY SMI_INCLUDE_DIR)
36 SET( SMI_LIBRARIES ${SMI_LIBRARY} )
37 SET( SMI_INCLUDE_DIRS ${SMI_INCLUDE_DIR} )
39 set ( SMI_DLL_DIR "${SMI_HINTS}/bin"
40 CACHE PATH "Path to the SMI DLL"
42 set ( SMI_SHARE_DIR "${SMI_HINTS}/share"
43 CACHE PATH "Path to the SMI MIBs"
45 file( GLOB _smi_dll RELATIVE "${SMI_DLL_DIR}"
46 "${SMI_DLL_DIR}/libsmi-*.dll"
48 set ( SMI_DLL ${_smi_dll}
49 # We're storing filenames only. Should we use STRING instead?
50 CACHE FILEPATH "SMI DLL file name"
52 mark_as_advanced( SMI_DLL_DIR SMI_DLL )
55 include(CheckSymbolExists)
56 cmake_push_check_state()
57 set(CMAKE_REQUIRED_INCLUDES ${SMI_INCLUDE_DIRS})
58 set(CMAKE_REQUIRED_LIBRARIES ${SMI_LIBRARIES})
59 # On Windows symbol visibility for global variables defaults to hidden
60 # and libsmi doesn't use any visibility decorators.
61 check_symbol_exists("smi_version_string" "smi.h" HAVE_SMI_VERSION_STRING)
62 cmake_pop_check_state()
66 SET( SMI_INCLUDE_DIRS )
72 MARK_AS_ADVANCED( SMI_LIBRARIES SMI_INCLUDE_DIRS )