1 Star 0 Fork 47

zhao_jd/socks_server

forked from Jack.arain/proxy 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 2.48 KB
一键复制 编辑 原始数据 按行查看 历史
Jack.arain 提交于 2020-09-28 11:39 . Adjust the directory structure
cmake_minimum_required(VERSION 3.0)
option(USE_HUNTER "Use hunter" OFF)
if (USE_HUNTER)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.253.tar.gz"
SHA1 "88ea6d37c897a81a080eb9ae0f69d7807bbb3c73"
)
endif()
project(socks_server)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-std=c++17 LIBCXX_HAS_STDCXX17_FLAG)
if (NOT MSVC)
if(NOT LIBCXX_HAS_STDCXX17_FLAG)
message(FATAL_ERROR "need at least GCC 9 or clang 9")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
else()
set(CompilerFlags
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO
)
#foreach(CompilerFlag ${CompilerFlags})
# string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
#endforeach()
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_WIN32_WINNT=0x0501)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
#set(Boost_USE_STATIC_RUNTIME ON)
if (USE_HUNTER)
hunter_add_package(Boost COMPONENTS thread system filesystem coroutine context program_options)
endif()
find_package(Boost CONFIG REQUIRED COMPONENTS thread system filesystem coroutine context program_options)
message(STATUS "Find boost version: ${Boost_VERSION}")
if (NOT Boost_VERSION VERSION_LESS 106700)
message(STATUS "Use boost coroutines v2")
add_definitions(-DBOOST_COROUTINES_V2)
endif()
if (USE_HUNTER AND MSVC)
add_definitions(-DBOOST_ALL_NO_LIB)
endif()
link_libraries(${Boost_LIBRARIES})
include_directories(${Boost_INCLUDE_DIRS})
file(GLOB libsocks_SRCS
libsocks/v7.c
libsocks/v7.h
libsocks/io.hpp
libsocks/socks_server.hpp
libsocks/async_connect.hpp
libsocks/socks_client.hpp
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libsocks)
add_executable(socks_server ${libsocks_SRCS}
src/server.cpp
)
add_executable(socks_client ${libsocks_SRCS}
src/client.cpp
)
if(UNIX)
target_link_libraries(socks_server ${Boost_LIBRARIES} pthread)
target_link_libraries(socks_client ${Boost_LIBRARIES} pthread)
else()
target_link_libraries(socks_server ${Boost_LIBRARIES})
target_link_libraries(socks_client ${Boost_LIBRARIES})
endif()
install(TARGETS socks_server RUNTIME DESTINATION bin)
install(TARGETS socks_client RUNTIME DESTINATION bin)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/zhao_jd/socks_server.git
git@gitee.com:zhao_jd/socks_server.git
zhao_jd
socks_server
socks_server
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385