-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
52 lines (38 loc) · 1.24 KB
/
CMakeLists.txt
File metadata and controls
52 lines (38 loc) · 1.24 KB
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
cmake_minimum_required(VERSION 3.14)
project(cppserver)
set(CMAKE_CXX_STANDARD 20)
# include(FetchContent)
# FetchContent_Declare(
# crow
# GIT_REPOSITORY https://github.com/CrowCpp/Crow.git
# GIT_TAG v1.0+1
# )
# FetchContent_MakeAvailable(crow)
# Prefer pthreads for threading
set(THREADS_PREFER_PTHREAD_FLAG ON)
# Find Threads library
find_package(Threads REQUIRED)
# Enable static linking for Boost
set(Boost_USE_STATIC_LIBS ON)
# Find Boost libraries
find_package(Boost 1.88 REQUIRED COMPONENTS system filesystem)
# Collect all source files in src/
file(GLOB SOURCES src/*.cpp)
add_executable(cppserver ${SOURCES} main.cpp)
# include_directories(/opt/homebrew/include)
# link_directories(/opt/homebrew/include)
# Include directories
target_include_directories(cppserver PRIVATE ${Boost_INCLUDE_DIRS} include)
target_link_libraries(cppserver PRIVATE /opt/homebrew/lib/libjsoncpp.dylib)
# target_link_libraries(cppserver PRIVATE crow::crow)
# Link against Boost and threading libraries
find_package(Boost REQUIRED COMPONENTS log log_setup filesystem system thread)
target_link_libraries(cppserver
PRIVATE
Boost::log
Boost::log_setup
Boost::filesystem
Boost::system
Boost::thread
Threads::Threads
)