-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCMakeLists.txt
49 lines (41 loc) · 1.51 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
cmake_policy(SET CMP0091 NEW)
project(pichi)
# Options
option(BUILD_SERVER "Build pichi application" ON)
option(BUILD_TEST "Build unit test cases" ON)
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(INSTALL_DEVEL "Install files for development" OFF)
option(ENABLE_CONAN "Enable conan" OFF)
option(TRANSPARENT_PF "Implement transparent ingress via Packet Filter" OFF)
option(TRANSPARENT_IPTABLES "Implement transparent ingress via Linux IPTables" OFF)
option(TLS_FINGERPRINT "Enable TLS fingerprint" ON)
# C++ standard options
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Preprocessing
if(ENABLE_CONAN AND CMAKE_CROSSCOMPILING)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(HandleDependencies)
include(Configure)
include(GNUInstallDirs)
# Setup global variables
# PICHI_LIBRARY: the target name of pichi library
# INSTALL_RPATH: the runtime paths for all targets
# MSVC_CRT: the correct library name for target property MSVC_RUNTIME_LIBRARY
set(PICHI_LIBRARY pichi_lib)
set(INSTALL_RPATH "$<IF:$<BOOL:${APPLE}>,@executable_path/../lib,$ORIGIN/../lib>")
set(MSVC_CRT "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_LIBS}>:DLL>")
# Setup the targets
add_subdirectory(src)
if(BUILD_SERVER)
add_subdirectory(server)
endif()
if(BUILD_TEST)
enable_testing()
add_subdirectory(test)
endif()