From de06e7008148c922f5c4bbe5d602be9ada1842c7 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 16 Oct 2020 17:10:02 +0200 Subject: [PATCH] cmake: fix MEMCACHED_BINARY --- CMakeConfig.txt | 5 +++-- test/CMakeLists.txt | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) 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) -- 2.30.2