From e1ebf81f769c2ce725deff04df71e72c33b54fc7 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Thu, 6 Jan 2011 16:59:48 -0600 Subject: [PATCH] Prefer static libraries for some dependencies on OS X This makes binary packaging easier because OS X doesn't ship with all the shared libraries we may link against (libmagic and libGeoIP in this case) --- cmake/FindLibGeoIP.cmake | 10 +++++++++- cmake/FindLibMagic.cmake | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cmake/FindLibGeoIP.cmake b/cmake/FindLibGeoIP.cmake index ef8529e2e3..618dba6463 100644 --- a/cmake/FindLibGeoIP.cmake +++ b/cmake/FindLibGeoIP.cmake @@ -21,8 +21,16 @@ find_path(LibGeoIP_ROOT_DIR NAMES include/GeoIPCity.h ) +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # the static version of the library is preferred on OS X for the + # purposes of making packages (libGeoIP doesn't ship w/ OS X) + set(libgeoip_names libGeoIp.a GeoIP) +else () + set(libgeoip_names GeoIP) +endif () + find_library(LibGeoIP_LIBRARY - NAMES GeoIP + NAMES ${libgeoip_names} HINTS ${LibGeoIP_ROOT_DIR}/lib ) diff --git a/cmake/FindLibMagic.cmake b/cmake/FindLibMagic.cmake index e96245e8c0..23cc7efe39 100644 --- a/cmake/FindLibMagic.cmake +++ b/cmake/FindLibMagic.cmake @@ -21,8 +21,16 @@ find_path(LibMagic_ROOT_DIR NAMES include/magic.h ) +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # the static version of the library is preferred on OS X for the + # purposes of making packages (libmagic doesn't ship w/ OS X) + set(libmagic_names libmagic.a magic) +else () + set(libmagic_names magic) +endif () + find_library(LibMagic_LIBRARY - NAMES magic + NAMES ${libmagic_names} HINTS ${LibMagic_ROOT_DIR}/lib )