From: Michael Wallner Date: Fri, 16 Oct 2020 15:10:02 +0000 (+0200) Subject: cmake: fix MEMCACHED_BINARY X-Git-Tag: 1.1.0-beta1~207 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=de06e7008148c922f5c4bbe5d602be9ada1842c7;p=m6w6%2Flibmemcached cmake: fix MEMCACHED_BINARY --- diff --git a/CMakeConfig.txt b/CMakeConfig.txt index 3f12665e..7e36cf5a 100644 --- a/CMakeConfig.txt +++ b/CMakeConfig.txt @@ -1,4 +1,4 @@ - + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if(NOT DEFINED ENV{CMAKE_BUILD_TYPE}) set(ENV{CMAKE_BUILD_TYPE} Release) @@ -48,7 +48,8 @@ set(ENABLE_SANITIZERS $ENV{ENABLE_SANITIZERS} CACHE STRING "sanitizers to enable (e.g. address undefined ...)") if(BUILD_TESTING) - find_program(MEMCACHED_BINARY memcached DOC "memcached binary") + set(MEMCACHED_BINARY $ENV{MEMCACHED_BINARY} + CACHE STRING "memcached binary") set(CMAKE_CTEST_ARGUMENTS "--output-on-failure") if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17) # available since CMake 3.17 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9ea8cd2c..2339a55b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,6 +4,15 @@ endif() include(CMake/Catch.cmake) +if(NOT MEMCACHED_BINARY) + find_program(MEMCACHED_BINARY memcached DOC "memcached binary") + if(NOT MEMCACHED_BINARY) + message(SEND_ERROR "Could not find memcached(1) binary") + set(ENV{INVALID_CONFIGURATION} 1) + endif() +endif() + + check_decl(pipe2 unistd.h) check_decl(SOCK_NONBLOCK sys/socket.h) check_decl(SOCK_CLOEXEC sys/socket.h)