-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
68 lines (60 loc) · 1.63 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
cmake_minimum_required(VERSION 3.22)
project(forest_mq C)
set(CMAKE_C_STANDARD 11)
add_executable(forest_mq main.c
consumer.c
consumer.h
provider.c
provider.h
queue.c
queue.h
exchange.c
exchange.h
config.c
config.h
server.c
server.h
utils.c
utils.h
)
find_package(PkgConfig REQUIRED)
if (APPLE)
EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
message( STATUS "Mac arch: ${ARCHITECTURE}" )
if (ARCHITECTURE MATCHES "x86_64")
set(BREW_ROOT "/usr/local")
message("Setting brew root as ${BREW_ROOT} for ${ARCHITECTURE}")
else ()
set(BREW_ROOT "/opt/homebrew")
message("Setting brew root as ${BREW_ROOT} for ${ARCHITECTURE}")
endif ()
target_include_directories(
forest_mq
PRIVATE
${BREW_ROOT}/Cellar/jansson/2.14/include
${BREW_ROOT}/Cellar/libevent/2.1.12_1/include
)
elseif (UNIX)
target_include_directories(
forest_mq
PRIVATE
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libjansson.so
)
endif()
if (APPLE)
message("Setting target_link_libraries brew root as ${BREW_ROOT} for ${ARCHITECTURE}")
target_link_libraries(
forest_mq
PRIVATE
${BREW_ROOT}/Cellar/jansson/2.14/lib/libjansson.dylib
${BREW_ROOT}/Cellar/libevent/2.1.12_1/lib/libevent.dylib
)
elseif(UNIX)
target_link_libraries(
forest_mq
PRIVATE
jansson
event
)
endif ()