Kylin/CMakeLists.txt
2024-10-29 13:51:37 +00:00

76 lines
2.0 KiB
CMake

cmake_minimum_required(VERSION 3.15)
project(Kylin)
option(INDEPENDENT_BUILD "build self." OFF)
option(DISABLE_LOG "disable log" OFF)
option(UNIT_TEST "do unit test" OFF)
option(KYLIN_WITH_NNG "use nng" OFF)
if(INDEPENDENT_BUILD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
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
)
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)
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)
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)
endif()
option(Boost_USE_STATIC_LIBS OFF)
add_subdirectory(Examples)
endif()
find_package(Boost REQUIRED COMPONENTS log serialization)
set(OpenSSL_LIBRARY ssl crypto)
add_subdirectory(DataStructure)
if(TARGET Boost::serialization)
add_subdirectory(Encrypt)
endif()
add_subdirectory(HttpProxy)
if(KYLIN_WITH_FLUENT)
add_subdirectory(Fluent)
endif()
add_subdirectory(Universal)
if(KYLIN_WITH_NNG)
add_subdirectory(Nng)
endif()
if(UNIT_TEST)
add_subdirectory(UnitTest)
endif()