-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakelists.txt
95 lines (82 loc) · 4.13 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
86
87
88
89
90
91
92
93
94
95
# This CMakeList.txt has been generated with ChatGPT o1, 2024 Dec
# subject to modify for future changes
cmake_minimum_required(VERSION 3.22)
# ------------------------------------------------------------------------------
# Project name, version, description, and languages
# ------------------------------------------------------------------------------
project(discord-bot
VERSION 1.0
DESCRIPTION "A Discord bot"
LANGUAGES CXX
)
# ------------------------------------------------------------------------------
# C++ standard
# ------------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ------------------------------------------------------------------------------
# Add cmake/ to the module path (for custom Find modules)
# ------------------------------------------------------------------------------
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# ------------------------------------------------------------------------------
# Optionally control where build artifacts go
# (Typically, let CMake create its own 'build' directory; but if you
# really want a custom output dir, uncomment these lines)
# ------------------------------------------------------------------------------
# set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# ------------------------------------------------------------------------------
# Locate dependencies using custom or system Find modules
# ------------------------------------------------------------------------------
find_package(DPP REQUIRED) # Provided by FindDPP.cmake in cmake/
find_package(Spdlog REQUIRED) # Provided by FindSpdlog.cmake in cmake/
find_package(OpenSSL REQUIRED) # Typically provided by the system
# ------------------------------------------------------------------------------
# Add your executable and source files
# ------------------------------------------------------------------------------
add_executable(${PROJECT_NAME}
src/main.cpp
# Add other .cpp source files here if needed
)
# ------------------------------------------------------------------------------
# If you have headers in include/, prefer target-based includes:
# ------------------------------------------------------------------------------
target_include_directories(${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include # Your project's own headers
)
# ------------------------------------------------------------------------------
# If your FindDPP.cmake and FindSpdlog.cmake define DPP::DPP and spdlog::spdlog
# as IMPORTED targets, you can link them directly.
# Otherwise, use the variables they provide (like DPP_LIBRARIES, SPDLOG_LIBRARIES).
# ------------------------------------------------------------------------------
target_link_libraries(${PROJECT_NAME}
PRIVATE
# If DPP provides an imported target named DPP::DPP, use it:
# DPP::DPP
# Otherwise, fall back to the variable from your custom Find script:
${DPP_LIBRARIES}
# If spdlog provides an imported target named spdlog::spdlog, use it:
# spdlog::spdlog
# Otherwise, fall back to the variable from your custom Find script:
${SPDLOG_LIBRARIES}
# Link OpenSSL (imported targets)
OpenSSL::SSL
OpenSSL::Crypto
)
# ------------------------------------------------------------------------------
# If your custom FindDPP or FindSpdlog scripts define include directories
# as DPP_INCLUDE_DIR and SPDLOG_INCLUDE_DIR, you can add them here:
# ------------------------------------------------------------------------------
target_include_directories(${PROJECT_NAME}
PRIVATE
${DPP_INCLUDE_DIR}
${SPDLOG_INCLUDE_DIR}
)
# ------------------------------------------------------------------------------
# Optionally, you might install the target if you're distributing it:
# ------------------------------------------------------------------------------
# install(TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION bin
# )