-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
81 lines (66 loc) · 2.14 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
cmake_minimum_required (VERSION 3.15)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(BOT_NAME "guidingLight")
project(${BOT_NAME})
aux_source_directory("src" coresrc)
aux_source_directory("src/lib" codParts)
add_executable(${BOT_NAME} ${coresrc} ${codParts})
target_compile_definitions(${BOT_NAME} PUBLIC FMT_HEADER_ONLY)
string(ASCII 27 Esc)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set_target_properties(${BOT_NAME} PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
set(DPP_LIBRARIES dpp)
find_package(Threads REQUIRED)
find_package(DPP)
if(APPLE)
if(CMAKE_APPLE_SILICON_PROCESSOR)
set(OPENSSL_ROOT_DIR "/opt/homebrew/opt/openssl")
else()
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
endif()
find_package(OpenSSL REQUIRED)
else()
find_package(OpenSSL REQUIRED)
endif()
target_include_directories(${BOT_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
${OPENSSL_INCLUDE_DIR}
)
target_link_libraries(${BOT_NAME}
dl
${CMAKE_THREAD_LIBS_INIT}
${OPENSSL_CRYPTO_LIBRARY}
${OPENSSL_SSL_LIBRARY}
)
target_compile_definitions(${BOT_NAME} PUBLIC DPP_CORO)
target_compile_features(${BOT_NAME} PUBLIC cxx_std_20)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -Wpedantic")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
if (DPP_FOUND)
target_link_libraries(${BOT_NAME} ${DPP_LIBRARIES})
target_include_directories(${BOT_NAME} PUBLIC ${DPP_INCLUDE_DIR})
else()
message(WARNING "Could not find DPP install. Building from source instead.")
option(DPP_BUILD_TEST "" OFF)
include(FetchContent)
FetchContent_Declare(
libdpp
GIT_REPOSITORY https://github.com/brainboxdotcc/DPP.git
GIT_TAG master)
FetchContent_GetProperties(libdpp)
if(NOT libdpp_POPULATED)
FetchContent_Populate(libdpp)
target_include_directories(${BOT_NAME} PUBLIC
${libdpp_SOURCE_DIR}/include
)
add_subdirectory(
${libdpp_SOURCE_DIR}
${libdpp_BINARY_DIR}
EXCLUDE_FROM_ALL)
endif()
target_link_libraries(${BOT_NAME} dpp)
endif()