1 Star 0 Fork 6

wulaohu/sponge

forked from Eric Ling/sponge 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 2.64 KB
一键复制 编辑 原始数据 按行查看 历史
Eric Ling 提交于 2023-11-08 16:17 . redis连接池实现
cmake_minimum_required(VERSION 3.10)
project(sponge C CXX)
option(SPONGE_DISABLE_EXAMPLES "Disable build of sponge examples." OFF)
option(SPONGE_DISABLE_TESTS "Disable build of sponge tests." OFF)
# <------------ copy configuration file to bin --------------->
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
# Set the source directory of your configuration files
set(CONFIG_FILES
${PROJECT_SOURCE_DIR}/mysql.cnf
${PROJECT_SOURCE_DIR}/redis.cnf
# ${PROJECT_SOURCE_DIR}/config_file3.txt
)
# Set the destination directory of your configuration files in the build directory
set(CONFIG_FILES_DESTINATION ${PROJECT_SOURCE_DIR}/bin)
# Copy the configuration files from the source directory to the build directory
file(COPY ${CONFIG_FILES} DESTINATION ${CONFIG_FILES_DESTINATION})
# <---------- set c++ standard ------------->
# NOTE: you must build redis-plus-plus and your application code with the same standard.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# <------------ add muduo dependency --------------->
find_path(MUDUO_HEADER muduo REQUIRED)
find_library(MUDUO_BASE_LIB muduo_base REQUIRED)
find_library(MUDUO_NET_LIB muduo_net REQUIRED)
message("Found MUDUO_HEADER: ${MUDUO_HEADER}")
message("Found MUDUO_BASE_LIB: ${MUDUO_BASE_LIB}")
message("Found MUDUO_NET_LIB: ${MUDUO_NET_LIB}")
include_directories(${MUDUO_HEADER})
# <------------ add hiredis dependency --------------->
find_path(HIREDIS_HEADER hiredis REQUIRED)
find_library(HIREDIS_LIB hiredis REQUIRED)
message("Found HIREDIS_HEADER: ${HIREDIS_HEADER}")
message("Found HIREDIS_LIB: ${HIREDIS_LIB}")
include_directories(${HIREDIS_HEADER})
# <------------ add redis-plus-plus dependency -------------->
# NOTE: this should be *sw* NOT *redis++*
find_path(REDIS_PLUS_PLUS_HEADER sw REQUIRED)
find_library(REDIS_PLUS_PLUS_LIB redis++ REQUIRED)
message("Found REDIS_PLUS_PLUS_HEADER: ${REDIS_PLUS_PLUS_HEADER}")
message("Found REDIS_PLUS_PLUS_LIB: ${REDIS_PLUS_PLUS_LIB}")
include_directories(${REDIS_PLUS_PLUS_HEADER})
include_directories(thirdparty)
include_directories(src/include)
include_directories(src/include/database)
include_directories(src/include/database/mysql)
include_directories(src/include/log)
include_directories(src/include/model)
include_directories(src/include/threadpool)
include_directories(src/include/service)
include_directories(src/include/server)
include_directories(src/include/redis)
add_subdirectory(src)
# Add the example subdirectory if the option is not disabled
if (NOT SPONGE_DISABLE_EXAMPLES)
add_subdirectory(example)
endif()
# Add the test subdirectory if the option is not disabled
if (NOT SPONGE_DISABLE_TESTS)
add_subdirectory(test)
endif()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wulaohu/sponge.git
git@gitee.com:wulaohu/sponge.git
wulaohu
sponge
sponge
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385