[CMake] Using CMake on CLion and adding geoip library
Jakob van Bethlehem
jsvanbethlehem at gmail.com
Sat Jun 25 07:50:43 EDT 2016
Hej,
According to https://cmake.org/cmake/help/v3.4/module/CheckIncludeFile.html the ‘check_include_file’ is a function provided by a module. So you’ll need to include(CheckIncludeFile) at the beginning of your lists-file
Sincerely,
Jakob
> On 25 Jun 2016, at 08:09, Hgfjj Hhjgf <umihhgm at gmail.com> wrote:
>
> 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?
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160625/1922b02f/attachment-0001.html>
More information about the CMake
mailing list