-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
67 lines (46 loc) · 1.03 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
cmake_minimum_required(VERSION 3.10)
# set the project name
project(fspctl)
set(CMAKE_BUILD_TYPE Debug)
option(WITH_MQTT "Build with MQTT" ON)
find_package(PkgConfig REQUIRED)
pkg_check_modules(MODBUS REQUIRED libmodbus)
pkg_check_modules(OPENSSL openssl)
pkg_check_modules(MOSQUITTO libmosquitto)
# add the executable
add_executable(fspctl
src/main.c
src/fconf.c
src/futil.c
src/freg.c
src/fenergy.c
)
target_link_directories(fspctl
PUBLIC ${MODBUS_LIBRARY_DIRS}
)
target_include_directories(fspctl AFTER
PUBLIC ${MODBUS_INCLUDE_DIRS}
)
target_link_libraries(fspctl
${MODBUS_LIBRARIES}
)
target_sources(fspctl PRIVATE
src/fmqtt.c
)
IF (${MOSQUITTO_FOUND} AND ${OPENSSL_FOUND} AND ${WITH_MQTT})
target_compile_definitions(fspctl PRIVATE
USE_MQTT
)
target_link_directories(fspctl
PUBLIC ${MOSQUITTO_LIBRARY_DIRS}
${OPENSSL_LIBRARY_DIRS}
)
target_include_directories(fspctl AFTER
PUBLIC ${MOSQUITTO_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS}
)
target_link_libraries(fspctl
${MOSQUITTO_LIBRARIES}
${OPENSSL_LIBRARIES}
)
ENDIF()