2024-12-11 08:44:14 +08:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
2025-01-07 09:42:29 +08:00
|
|
|
project(tsc LANGUAGES CXX)
|
2024-12-13 12:35:08 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2024-12-11 08:44:14 +08:00
|
|
|
|
|
|
|
if (MSVC)
|
2025-02-14 09:40:08 +08:00
|
|
|
add_compile_options(/source-charset:utf-8)
|
2024-12-11 08:44:14 +08:00
|
|
|
endif()
|
2025-02-18 23:33:21 +08:00
|
|
|
if(DEFINED USE_BOOST)
|
|
|
|
message(STATUS "tsc use boost lib.")
|
2025-02-15 23:34:27 +08:00
|
|
|
include_directories(${MBOOST_INCLUDE_DIR})
|
|
|
|
link_directories(${MBOOST_LIB_DIR})
|
|
|
|
endif()
|
2024-12-11 08:44:14 +08:00
|
|
|
|
2025-01-07 09:42:29 +08:00
|
|
|
add_executable(tsc main.cpp client.h client.cpp config.h config.cpp)
|
2025-01-09 16:50:11 +08:00
|
|
|
target_link_libraries(tsc PRIVATE trans_net trans_util filecomplete)
|
2024-12-16 13:54:54 +08:00
|
|
|
if (UNIX)
|
2025-01-07 09:42:29 +08:00
|
|
|
target_link_libraries(tsc PRIVATE pthread)
|
2024-12-24 12:47:12 +08:00
|
|
|
endif()
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows")
|
2025-01-07 09:42:29 +08:00
|
|
|
target_link_libraries(tsc PRIVATE ws2_32 wsock32)
|
2025-02-15 23:34:27 +08:00
|
|
|
endif()
|
2025-02-18 23:33:21 +08:00
|
|
|
if(DEFINED USE_BOOST)
|
2025-02-15 23:34:27 +08:00
|
|
|
target_link_directories(tsc PRIVATE ${MBOOST_LIB_DIR})
|
|
|
|
target_link_libraries(tsc PRIVATE ${MBOOST_LIBS})
|
2025-02-17 18:29:23 +08:00
|
|
|
endif()
|
2025-04-16 22:19:49 +08:00
|
|
|
if (DEFINED GRAB_CRASH)
|
|
|
|
message(STATUS "tsc link crashelper")
|
|
|
|
target_link_libraries(tsc PRIVATE crashelper)
|
|
|
|
endif()
|
2025-02-17 18:29:23 +08:00
|
|
|
if(UNIX)
|
|
|
|
execute_process(
|
|
|
|
COMMAND uname -a
|
|
|
|
OUTPUT_VARIABLE UNAME_OUT
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
if(UNAME_OUT MATCHES "alpine" OR UNAME_OUT MATCHES "Alpine")
|
|
|
|
message(STATUS "tsc on musl static link")
|
|
|
|
target_link_libraries(tsc PRIVATE -static;-static-libstdc++)
|
|
|
|
endif()
|
|
|
|
endif()
|