38 lines
1.0 KiB
CMake
38 lines
1.0 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
||
project(MCP VERSION 2024.11.05 LANGUAGES CXX)
|
||
|
||
|
||
# Set C++ standard
|
||
set(CMAKE_CXX_STANDARD 17)
|
||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||
|
||
# Find required packages
|
||
find_package(Threads REQUIRED)
|
||
|
||
option(MCP_SSL "Enable SSL support" OFF)
|
||
|
||
if(MCP_SSL)
|
||
find_package(OpenSSL 3.0.0 COMPONENTS Crypto SSL REQUIRED)
|
||
include_directories(${OPENSSL_INCLUDE_DIR}) # before including cpp-httplib to avoid OpenSSL with lower version included
|
||
message(STATUS "OpenSSL include directory: ${OPENSSL_INCLUDE_DIR}")
|
||
add_compile_definitions(MCP_SSL CPPHTTPLIB_OPENSSL_SUPPORT)
|
||
endif()
|
||
|
||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common)
|
||
|
||
# Add MCP library
|
||
add_subdirectory(src)
|
||
|
||
# Add examples
|
||
add_subdirectory(examples)
|
||
|
||
# Add test directory
|
||
option(MCP_BUILD_TESTS "Build the tests" ON)
|
||
if(MCP_BUILD_TESTS)
|
||
enable_testing()
|
||
add_subdirectory(test)
|
||
|
||
# 注意:run_tests目标已在test/CMakeLists.txt中定义,此处不再重复定义
|
||
endif()
|