[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r4372: Add some CMake magic for searching for local MaxMind GeoIP l (in vidalia/trunk: . cmake)
Author: edmanm
Date: 2010-08-05 16:03:02 -0400 (Thu, 05 Aug 2010)
New Revision: 4372
Added:
vidalia/trunk/cmake/FindGeoIP.cmake
Modified:
vidalia/trunk/CMakeLists.txt
Log:
Add some CMake magic for searching for local MaxMind GeoIP libraries and
header files, as well as a Vidalia build option to use it (disabled by
default).
Modified: vidalia/trunk/CMakeLists.txt
===================================================================
--- vidalia/trunk/CMakeLists.txt 2010-08-05 19:20:48 UTC (rev 4371)
+++ vidalia/trunk/CMakeLists.txt 2010-08-05 20:03:02 UTC (rev 4372)
@@ -109,6 +109,12 @@
include(${CMAKE_SOURCE_DIR}/cmake/FindMarble.cmake)
endif(USE_MARBLE)
+## Find the MaxMind GeoIP library
+option(USE_GEOIP "Enable GeoIP lookups via a local MaxMind database" OFF)
+if (USE_GEOIP)
+ include(${CMAKE_SOURCE_DIR}/cmake/FindGeoIP.cmake)
+endif(USE_GEOIP)
+
## Check for system header files
check_include_file("limits.h" HAVE_LIMITS_H)
check_include_file("sys/limits.h" HAVE_SYS_LIMITS_H)
Added: vidalia/trunk/cmake/FindGeoIP.cmake
===================================================================
--- vidalia/trunk/cmake/FindGeoIP.cmake (rev 0)
+++ vidalia/trunk/cmake/FindGeoIP.cmake 2010-08-05 20:03:02 UTC (rev 4372)
@@ -0,0 +1,38 @@
+##
+## $Id$
+##
+## This file is part of Vidalia, and is subject to the license terms in the
+## LICENSE file, found in the top level directory of this distribution. If
+## you did not receive the LICENSE file with this file, you may obtain it
+## from the Vidalia source package distributed by the Vidalia Project at
+## http://www.vidalia-project.net/. No part of Vidalia, including this file,
+## may be copied, modified, propagated, or distributed except according to
+## the terms described in the LICENSE file.
+##
+
+## Tries to find the required MaxMind GeoIPlibraries. Once done this will
+## define the variable GEOIP_LIBRARIES.
+
+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)
+
Property changes on: vidalia/trunk/cmake/FindGeoIP.cmake
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native