[CMake] Using CMake on CLion and adding geoip library

Hgfjj Hhjgf umihhgm at gmail.com
Sat Jun 25 02:09:04 EDT 2016


I am trying to use an external library (GeoIP). CMake list contains:

message(STATUS "Looking for MaxMind GeoIP header files")

set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH} ${GEOIP_INCLUDE_DIR}")
check_include_file("GeoIP.h" HAVE_GEOIP_H)
check_include_file("GeoIPCity.h" HAVE_GEOIPCITY_H)
if (HAVE_GEOIP_H AND HAVE_GEOIPCITY_H)
    message(STATUS "Looking for MaxMind GeoIP header files - found")
else(HAVE_GEOIP_H AND HAVE_GEOIPCITY_H)
    message(FATAL_ERROR "Could not find one or more MaxMind GeoIP
header files. If the MaxMind GeoIP library is installed, you can run
CMake again and specify its location with -DGEOIP_INCLUDE_DIR=<path>")
endif(HAVE_GEOIP_H AND HAVE_GEOIPCITY_H)

message(STATUS "Looking for MaxMind GeoIP libraries")
find_library(GEOIP_LIB
        NAMES GeoIP geoip
        PATHS ${GEOIP_LIBRARY_DIR}
        )
if (GEOIP_LIB)
    message(STATUS "Looking for MaxMind GeoIP libraries - found")
    set(GEOIP_LIBRARIES ${GEOIP_LIB})
else(GEOIP_LIB)
    message(FATAL_ERROR "Could not find MaxMind GeoIP library")
endif(GEOIP_LIB)

but getting error like "Unknown cmake command: check_include_file"
what's the problem here then?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160625/a5f716f3/attachment.html>


More information about the CMake mailing list