debian: fix build-deps for focal
[amule.git] / cmake / ip2country.cmake
blobf8a228751ac5f7ed263b8ccf513103fd0941dbc2
1 if (GEOIP_INCLUDE_DIR)
2         set (CMAKE_REQUIRED_INCLUDES ${GEOIP_INCLUDE_DIR})
3 endif()
5 if (NOT GEOIP_LIB)
6         include (CheckIncludeFile)
9         check_include_file (GeoIP.h GEOIP_H)
11         if (GEOIP_H)
12                 find_library (GEOIP_LIB GeoIP)
14                 if (NOT GEOIP_LIB AND GEOIP_INCLUDE_DIR)
15                         find_library (GEOIP_LIB GeoIP
16                                 PATHS ${GEOIP_INCLUDE_DIR}
17                         )
18                 endif()
20                 if (NOT GEOIP_LIB)
21                         set (ENABLE_IP2COUNTRY FALSE)
22                         message (STATUS "GeoIP lib not found, disabling support")
23                 else()
24                         message (STATUS "GeoIP found useable")
25                 endif()
26         else()
27                 set (ENABLE_IP2COUNTRY FALSE)
28                 message (STATUS "GeoIP headers not found, disabling support")
29         endif()
30 endif()
32 if (ENABLE_IP2COUNTRY)
33         add_library (GeoIP::Shared UNKNOWN IMPORTED)
35         set_target_properties (GeoIP::Shared PROPERTIES
36                 INTERFACE_COMPILE_DEFINITIONS "ENABLE_IP2COUNTRY"
37                 INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_REQUIRED_INCLUDES}"
38                 IMPORTED_LOCATION "${GEOIP_LIB}"
39         )
40 endif()
42 unset (CMAKE_REQUIRED_INCLUDES)