Kylin/CMakeLists.txt

76 lines
2.0 KiB
CMake
Raw Permalink Normal View History

2023-07-21 10:47:31 +08:00
cmake_minimum_required(VERSION 3.15)
project(Kylin)
2024-09-05 22:05:05 +08:00
option(INDEPENDENT_BUILD "build self." OFF)
2024-09-16 01:32:40 +08:00
option(DISABLE_LOG "disable log" OFF)
2023-12-25 18:52:51 +08:00
option(UNIT_TEST "do unit test" OFF)
2024-10-29 21:51:37 +08:00
option(KYLIN_WITH_NNG "use nng" OFF)
2023-12-25 18:52:51 +08:00
2024-09-05 22:05:05 +08:00
if(INDEPENDENT_BUILD)
2024-09-05 22:17:23 +08:00
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2024-09-05 22:05:05 +08:00
set(KYLIN_WITH_FLUENT ON)
if(WIN32)
set(Projects_ROOT E:/Projects)
set(Libraries_ROOT ${Projects_ROOT}/Libraries)
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_86_0_msvc2022_64bit)
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_86)
add_compile_definitions(
BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN10
)
2024-09-05 22:17:23 +08:00
set(OpenSSL_ROOT D:/Qt/Tools/OpenSSLv3/Win_x64)
set(OPENSSL_INCLUDE_DIR ${OpenSSL_ROOT}/include)
set(OpenSSL_LIBRARY_DIRS ${OpenSSL_ROOT}/lib)
set(OpenSSL_LIBRARIES libssl libcrypto)
2024-09-05 22:05:05 +08:00
else()
execute_process(
COMMAND sh -c "echo $HOME"
OUTPUT_VARIABLE USER_HOME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(Projects_ROOT ${USER_HOME}/Projects)
set(Libraries_ROOT /opt/Libraries)
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_86_0)
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include)
2024-10-29 21:51:37 +08:00
set(MBEDTLS_ROOT ${Libraries_ROOT}/mbedtls-3.6.2)
set(MBEDTLS_INCLUDE_DIR ${MBEDTLS_ROOT}/include)
set(MBEDTLS_LIBRARY_DIRS ${MBEDTLS_ROOT}/lib)
set(NNG_ROOT ${Libraries_ROOT}/nng-1.9.0)
set(NNG_INCLUDE_DIR ${NNG_ROOT}/include)
set(NNG_LIBRARY_DIRS ${NNG_ROOT}/lib)
2024-09-05 22:05:05 +08:00
endif()
2024-09-05 22:17:23 +08:00
option(Boost_USE_STATIC_LIBS OFF)
2024-09-05 22:05:05 +08:00
add_subdirectory(Examples)
endif()
2023-12-27 10:29:16 +08:00
find_package(Boost REQUIRED COMPONENTS log serialization)
2023-08-01 13:54:17 +08:00
set(OpenSSL_LIBRARY ssl crypto)
2023-12-27 10:29:16 +08:00
add_subdirectory(DataStructure)
2023-07-21 14:07:27 +08:00
2023-12-03 23:42:58 +08:00
if(TARGET Boost::serialization)
add_subdirectory(Encrypt)
endif()
2023-12-29 19:10:38 +08:00
add_subdirectory(HttpProxy)
2023-12-03 23:42:58 +08:00
2024-09-04 18:29:03 +08:00
if(KYLIN_WITH_FLUENT)
add_subdirectory(Fluent)
2023-12-07 19:46:15 +08:00
endif()
2023-12-03 23:42:58 +08:00
2023-12-27 10:29:16 +08:00
add_subdirectory(Universal)
2023-12-25 18:52:51 +08:00
2024-10-29 21:51:37 +08:00
if(KYLIN_WITH_NNG)
add_subdirectory(Nng)
endif()
2023-12-25 18:52:51 +08:00
if(UNIT_TEST)
add_subdirectory(UnitTest)
endif()