1 Star 0 Fork 0

Ivanmax/WebD

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 2.38 KB
一键复制 编辑 原始数据 按行查看 历史
Ivanqi 提交于 2021-04-26 11:46 . 【开发】增加fastcgi功能
cmake_minimum_required(VERSION 2.6)
project(webd CXX)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "debug")
endif()
message(STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR})
message(STATUS "PROJECT_BINARY_DIR: " ${PROJECT_BINARY_DIR})
message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
message(STATUS "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH})
message(STATUS "CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH})
if(NOT NETWORKER_PATH)
set(NETWORKER_PATH "/usr")
message(STATUS "NETWORKER_PATH: " ${NETWORKER_PATH})
endif()
if(NOT NETWORKER_LIB_PATH)
set(NETWORKER_LIB_PATH ${NETWORKER_PATH} "/local")
message(STATUS "NETWORKER_LIB_PATH: " ${NETWORKER_LIB_PATH})
endif()
set(CXX_FLAGS
-g
-Wall
-std=c++17
-Werror
-rdynamic
)
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_CXX_FLAGS_DEBUG "-O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -finline-limit=1000 -DNDEBUG")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
# find_path 用来在指定路径中搜索文件名
find_path(NetWorker_INCLUDE_DIR networker "${NETWORKER_PATH}/include")
find_path(NetWorker_LIBRARY_DIR NAMES "libnetworker_net.a" "${NETWORKER_LIB_PATH}/lib" PATH_SUFFIXES lib)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${NetWorker_LIBRARY_DIR})
message(STATUS "NetWorker_INCLUDE_DIR: " ${NetWorker_INCLUDE_DIR})
message(STATUS "NetWorker_LIBRARY_DIR: " ${NetWorker_LIBRARY_DIR})
# include_directories 将指定目录添加到编译器头文件搜索路径之下,指定的目录被解释成当前源码路径的相对路径
include_directories(${NetWorker_LIBRARY_DIR})
# find_library 该命令用于搜索动态文件路径,里面的内容为自定义的变量名、动态文件名、具体路径
find_library(networker_base networker_base)
find_library(networker_net networker_net)
message(STATUS ${networker_base})
message(STATUS ${networker_net})
include_directories(${PROJECT_SOURCE_DIR})
set(src_dir
src/HttpContext.cpp
src/HttpResponse.cpp
src/HttpResponse.cpp
src/HttpServer.cpp
src/Entry.cpp
src/TemplateReplace.cpp
src/Fastcgi.cpp
)
add_executable(webd ${src_dir} ./main.cpp)
# target_link_libraries 这个指令可以用来添加需要链接的共享库
target_link_libraries(webd ${networker_net})
target_link_libraries(webd ${networker_base})
target_link_libraries(webd pthread rt)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Ivanmax/WebD.git
git@gitee.com:Ivanmax/WebD.git
Ivanmax
WebD
WebD
master

搜索帮助