-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
49 lines (39 loc) · 1.15 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
cmake_minimum_required(VERSION 3.10)
project(memcachex VERSION 0.1.0 LANGUAGES CXX)
# Print helpful message about build directory
message(STATUS "Configure with: mkdir -p build && cd build && cmake ..")
message(STATUS "Then build with: cmake --build .")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find libmemcached
find_path(LIBMEMCACHED_INCLUDE_DIR libmemcached/memcached.h)
find_library(LIBMEMCACHED_LIBRARY memcached)
# Check if libmemcached was found
if(NOT LIBMEMCACHED_INCLUDE_DIR OR NOT LIBMEMCACHED_LIBRARY)
message(FATAL_ERROR "libmemcached not found. Please install libmemcached development files.")
endif()
# Library target
add_library(memcachex
src/MemcachedClient.cpp
)
target_include_directories(memcachex
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
PRIVATE
${LIBMEMCACHED_INCLUDE_DIR}
)
target_link_libraries(memcachex
PRIVATE
${LIBMEMCACHED_LIBRARY}
)
# Examples
add_subdirectory(examples)
# Installation
install(TARGETS memcachex
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)
install(FILES src/MemcachedClient.h
DESTINATION include/memcachex
)