File: FindGEOIP.cmake

package info (click to toggle)
ettercap 1%3A0.8.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,108 kB
  • sloc: ansic: 57,711; yacc: 313; lex: 204; makefile: 120; sh: 83; xml: 69
file content (53 lines) | stat: -rw-r--r-- 1,325 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#
# - Find GeoIP
# Find the native GeoIP includes and library
#
#  GEOIP_INCLUDE_DIRS - where to find GeoIP.h, etc.
#  GEOIP_LIBRARIES    - List of libraries when using GeoIP.
#  GEOIP_FOUND        - True if GeoIP found.

if(GEOIP_INCLUDE_DIRS)
  # Already in cache, be silent
  set(GEOIP_FIND_QUIETLY TRUE)
endif()

# Users may set the (environment) variable GEOIP_ROOT
# to point cmake to the *root* of a directory with include
# and lib subdirectories for GeoIP
if(GEOIP_ROOT)
  set(GEOIP_ROOT PATHS ${GEOIP_ROOT} NO_DEFAULT_PATH)
else()
  set(GEOIP_ROOT $ENV{GEOIP_ROOT})
endif()

find_package(PkgConfig)
pkg_search_module(GEOIP geoip)

# Find the header
find_path(GEOIP_INCLUDE_DIR GeoIP.h
  HINTS
    "${GEOIP_INCLUDEDIR}"
    "${GEOIP_ROOT}"
  PATH_SUFFIXES include Include
)

# Find the library
find_library(GEOIP_LIBRARY
  NAMES GeoIP libGeoIP-1
  HINTS
    "${GEOIP_LIBDIR}"
    "${GEOIP_ROOT}"
  PATH_SUFFIXES lib
)

# handle the QUIETLY and REQUIRED arguments and set GEOIP_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GEOIP DEFAULT_MSG GEOIP_LIBRARY GEOIP_INCLUDE_DIR)

if(GEOIP_FOUND)
  set(GEOIP_LIBRARIES ${GEOIP_LIBRARY})
  set(GEOIP_INCLUDE_DIRS ${GEOIP_INCLUDE_DIR})
endif()

mark_as_advanced(GEOIP_LIBRARIES GEOIP_INCLUDE_DIRS)