2 set (CMAKE_REQUIRED_INCLUDES ${GEOIP_INCLUDE_DIR})
6 include (CheckIncludeFile)
9 check_include_file (GeoIP.h 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}
21 set (ENABLE_IP2COUNTRY FALSE)
22 message (STATUS "GeoIP lib not found, disabling support")
24 message (STATUS "GeoIP found useable")
27 set (ENABLE_IP2COUNTRY FALSE)
28 message (STATUS "GeoIP headers not found, disabling support")
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}"
42 unset (CMAKE_REQUIRED_INCLUDES)