-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (69 loc) · 2.07 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
# For INTERPROCEDURAL_OPTIMIZATION
if (POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
endif()
project(s3-proxy)
# Enable C++23 features
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
# Find includes in the build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
if (UNIX AND NOT APPLE)
if (CMAKE_HOST_SYSTEM_PROCESSOR EQUAL "arm64" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=mold")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=mold")
message(STATUS "Enabling mold linker")
elseif (CMAKE_HOST_SYSTEM_PROCESSOR EQUAL "aarch64" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=mold")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=mold")
message(STATUS "Enabling mold linker")
endif (CMAKE_HOST_SYSTEM_PROCESSOR EQUAL "arm64" )
endif (UNIX AND NOT APPLE)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
set(Boost_USE_MULTITHREADED ON)
set(OPENSSL_USE_STATIC_LIBS TRUE)
if (APPLE)
find_package(OpenSSL REQUIRED)
endif()
find_package(Boost REQUIRED COMPONENTS iostreams json)
find_package(mongocxx REQUIRED)
find_package(fmt REQUIRED)
find_package(range-v3 REQUIRED)
find_package(Threads)
find_package(ZLIB)
find_package(AWSSDK REQUIRED COMPONENTS s3)
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
endif()
include_directories(
${LIBMONGOCXX_STATIC_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
)
if (APPLE)
include_directories(
/usr/local/aws-sdk/include
/usr/local/nghttp2/include
)
LINK_DIRECTORIES(
/usr/local/nghttp2/lib
)
set(CMAKE_MACOSX_RPATH 1)
elseif (UNIX)
link_directories(
/opt/local/lib
)
endif()
set(CMAKE_INSTALL_PREFIX /opt/spt)
add_definitions(-DCACHE_TTL=86400)
add_subdirectory(src)
if (BUILD_TESTING)
enable_testing()
add_subdirectory(test/integration)
endif()