forked from BlackZork/mqmgateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (45 loc) · 1.82 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
cmake_minimum_required(VERSION 3.13)
project(modmqttd VERSION 1.0.0)
option(WITHOUT_TESTS "Do not build unit tests")
set(build_unittests)
if (WITHOUT_TESTS)
set(build_unittests EXCLUDE_FROM_ALL)
endif()
find_package(Boost 1.54.0 REQUIRED COMPONENTS log program_options)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(BOOST_ALL_DYN_LINK ON)
find_package(PkgConfig)
pkg_check_modules(LIBMODBUS REQUIRED libmodbus)
find_package(Threads)
find_package(yaml-cpp REQUIRED)
find_package(RapidJSON REQUIRED)
find_path(EXPRTK_INCLUDE_DIR "exprtk.hpp")
message(STATUS "EXPRTK_INCLUDE_DIR => ${EXPRTK_INCLUDE_DIR}")
include_directories(${Boost_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR} ${RAPIDJSON_INCLUDE_DIRS} .)
link_directories(${Boost_LIBRARY_DIRS})
# force boost dynamic linking
add_definitions(-DBOOST_LOG_DYN_LINK)
add_subdirectory(libmodmqttconv)
add_subdirectory(libmodmqttsrv)
add_subdirectory(modmqttd)
add_subdirectory(unittests ${build_unittests})
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/modmqttd")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
add_subdirectory(stdconv)
add_dependencies(modmqttd stdconv)
add_dependencies(tests stdconv)
if (EXPRTK_INCLUDE_DIR)
include_directories(${EXPRTK_INCLUDE_DIR})
add_subdirectory(exprconv)
target_compile_definitions(tests PRIVATE HAVE_EXPRTK)
add_dependencies(modmqttd exprconv)
add_dependencies(tests exprconv)
install(TARGETS exprconv DESTINATION lib/modmqttd)
endif()
install (TARGETS modmqttd DESTINATION bin)
install (TARGETS modmqttsrv DESTINATION lib)
install (DIRECTORY "${PROJECT_SOURCE_DIR}/libmodmqttconv" DESTINATION include FILES_MATCHING PATTERN "*.hpp")
install(TARGETS stdconv DESTINATION lib/modmqttd)
install(FILES modmqttd.service DESTINATION lib/systemd/system)