-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
47 lines (40 loc) · 1.07 KB
/
CMakeLists.txt
File metadata and controls
47 lines (40 loc) · 1.07 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
project("Message Core" C)
cmake_minimum_required(VERSION 3.0)
set(TARGET_GROUP production CACHE STRING "Group to build")
OPTION(MQTT_PAHO "Enable Paho MQTT")
set (CMAKE_C_STANDARD 11)
IF(${MQTT_PAHO})
message("Building MQTT Paho support")
find_library(PAHO_LIB paho-mqtt3c-static REQUIRED)
SET(MQTT_PAHO_SRC src/msg_mqtt_paho.c)
SET(CMAKE_C_FLAGS "-DMQTT_PAHO")
ENDIF()
add_library(msg_core STATIC
src/msg_core.c
src/msg_gcp_mqtt.c
src/msg_mqtt.c
src/msg_pipe_splitter.c
src/msg_pipe.c
src/msg_tcpip.c
src/msg_utils.c
${MQTT_PAHO_SRC}
)
if(TARGET_GROUP STREQUAL production)
# production
elseif(TARGET_GROUP STREQUAL test)
include(CTest)
add_subdirectory(test)
ENDIF()
target_include_directories(msg_core PUBLIC include)
install(TARGETS msg_core DESTINATION lib)
install(FILES
include/logger.h
include/msg_core.h
include/msg_gcp_mqtt.h
include/msg_mqtt.h
include/msg_pipe_splitter.h
include/msg_pipe.h
include/msg_tcpip.h
include/msg_utils.h
include/msg_mqtt_paho.h
DESTINATION include)