libhv/CMakeLists.txt

49 lines
1.4 KiB
CMake
Raw Permalink Normal View History

cmake_minimum_required(VERSION 3.0)
project(libhv)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-elide-constructors")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-elide-constructors")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message("Building for Linux platform")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
message("Building for macOS platform")
set(CMAKE_C_COMPILER "/opt/homebrew/bin/aarch64-apple-darwin23-gcc-14") # gcc clang` 指定c编译器
set(CMAKE_CXX_COMPILER "/opt/homebrew/bin/aarch64-apple-darwin23-g++-14") # g++ clang++` 指定c++编译器
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
message("Building for Windows platform")
else()
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
include_directories(include)
include_directories(/usr/local/include)
find_package(debugstream)
# find_package(hv REQUIRED)
set(LIB
debugstream
/usr/local/lib/libhv.so
)
add_executable(client_tcp src/client_tcp_main.cc)
target_link_libraries(client_tcp ${LIB})
add_executable(server_tcp src/server_tcp_main.cc)
target_link_libraries(server_tcp ${LIB})
2024-11-26 17:08:27 +08:00
add_executable(udp_client src/udp_client_main.cc)
target_link_libraries(udp_client ${LIB})
add_executable(udp_server src/udp_server_main.cc)
target_link_libraries(udp_server ${LIB})
enable_testing()
add_subdirectory(test)