Skip to content

Commit

Permalink
Make the libmemcached version detection better, make errors fatal so …
Browse files Browse the repository at this point in the history
…they appear right away
  • Loading branch information
Scott MacVicar committed Jul 30, 2010
1 parent 1609cd4 commit 650183e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
11 changes: 10 additions & 1 deletion CMake/FindLibmemcached.cmake
Expand Up @@ -18,11 +18,20 @@ FIND_PATH(LIBMEMCACHED_INCLUDE_DIR libmemcached/memcached.h)

FIND_LIBRARY(LIBMEMCACHED_LIBRARY memcached)

# handle the QUIETLY and REQUIRED arguments and set Libmemcached_FOUND to TRUE if
# handle the QUIETLY and REQUIRED arguments and set Libmemcached_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libmemcached DEFAULT_MSG LIBMEMCACHED_LIBRARY LIBMEMCACHED_INCLUDE_DIR)

SET(LIBMEMCACHED_VERSION 0)

IF(LIBMEMCACHED_FOUND)
if (EXISTS "${LIBMEMCACHED_INCLUDE_DIR}/libmemcached/configure.h")
FILE(READ "${LIBMEMCACHED_INCLUDE_DIR}/libmemcached/configure.h" _MEMCACHE_VERSION_CONENTS)
STRING(REGEX REPLACE ".*#define LIBMEMCACHED_VERSION_STRING \"([0-9.]+)\".*" "\\1" LIBMEMCACHED_VERSION "${_MEMCACHE_VERSION_CONENTS}")
endif()
ENDIF()

IF(LIBMEMCACHED_FOUND)
SET(LIBMEMCACHED_LIBRARIES ${LIBMEMCACHED_LIBRARY})
SET(LIBMEMCACHED_INCLUDE_DIRS ${LIBMEMCACHED_INCLUDE_DIR})
Expand Down
13 changes: 9 additions & 4 deletions CMake/HPHPFindLibs.cmake
Expand Up @@ -33,6 +33,11 @@ link_directories(${MYSQL_LIB_DIR})

# libmemcached checks
find_package(Libmemcached REQUIRED)
if (LIBMEMCACHED_VERSION VERSION_LESS "0.39")
message(FATAL_ERROR "libmemcache is too old, found ${LIBMEMCACHED_VERSION} and we need 0.39")
unset(LIBMEMCACHED_INCLUDE_DIR)
unset(LIBMEMCACHED_LIBRARIES)
endif ()
include_directories(${LIBMEMCACHED_INCLUDE_DIR})

# pcre checks
Expand All @@ -46,7 +51,7 @@ include_directories(${LIBEVENT_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES "${LIBEVENT_LIB}")
CHECK_FUNCTION_EXISTS("evhttp_bind_socket_with_fd" HAVE_CUSTOM_LIBEVENT)
if (NOT HAVE_CUSTOM_LIBEVENT)
message(SEND_ERROR "Custom libevent is required with HipHop patches")
message(FATAL_ERROR "Custom libevent is required with HipHop patches")
unset(HAVE_CUSTOM_LIBEVENT CACHE)
unset(LIBEVENT_INCLUDE_DIR CACHE)
unset(LIBEVENT_LIB CACHE)
Expand All @@ -73,7 +78,7 @@ include_directories(${CURL_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES "${CURL_LIBRARIES}")
CHECK_FUNCTION_EXISTS("curl_multi_select" HAVE_CUSTOM_CURL)
if (NOT HAVE_CUSTOM_CURL)
message(SEND_ERROR "Custom libcurl is required with HipHop patches ${HAVE_CUSTOM_CURL}")
message(FATAL_ERROR "Custom libcurl is required with HipHop patches ${HAVE_CUSTOM_CURL}")
unset(HAVE_CUSTOM_CURL CACHE)
unset(CURL_INCLUDE_DIR CACHE)
unset(CURL_LIBRARIES CACHE)
Expand Down Expand Up @@ -111,7 +116,7 @@ endif()
find_package(ICU REQUIRED)
if (ICU_FOUND)
if (ICU_VERSION VERSION_LESS "4.2")
message(SEND_ERROR "ICU is too old, found ${ICU_VERSION} and we need 4.2")
message(FATAL_ERROR "ICU is too old, found ${ICU_VERSION} and we need 4.2")
unset(ICU_FOUND CACHE)
unset(ICU_INCLUDE_DIRS CACHE)
unset(ICU_LIBRARIES CACHE)
Expand Down Expand Up @@ -141,7 +146,7 @@ endif()
# tbb libs
find_package(TBB REQUIRED)
if (${TBB_INTERFACE_VERSION} LESS 3016)
message(SEND_ERROR "TBB is too old, please install a newer version")
message(FATAL_ERROR "TBB is too old, please install a newer version")
unset(TBB_FOUND CACHE)
unset(TBB_INCLUDE_DIRS CACHE)
unset(TBB_LIBRARIES CACHE)
Expand Down

0 comments on commit 650183e

Please sign in to comment.