|
8 | 8 | # Contact KDAB at <info@kdab.com> for commercial licensing options. |
9 | 9 | # |
10 | 10 |
|
11 | | -include(FetchContent) |
12 | | - |
13 | 11 | message(STATUS "Looking for KDUtils dependencies") |
14 | 12 |
|
15 | | -# spdlog Logging Library |
16 | | -# spdlog needs to be installed. If already exists in the prefix, |
17 | | -# we don't want to override it, so first we try to find it. |
18 | | -# If we don't find it, then we fetch it and install it |
19 | | -find_package(spdlog 1.14.1 QUIET) |
20 | | - |
21 | | -if(NOT TARGET spdlog::spdlog) |
22 | | - # We need to use external fmt because the one bundled with spldog 1.x throws |
23 | | - # warnings in newer Visual Studio MSVC compiler versions. |
24 | | - # See https://github.com/gabime/spdlog/issues/2912 |
25 | | - # TODO(spdlog2): external fmt can possibly be removed once splog 2.x is used |
26 | | - # which bundles newer fmt version |
27 | | - find_package(fmt 10.2.1 QUIET) |
28 | | - if(NOT TARGET fmt) |
29 | | - FetchContent_Declare( |
30 | | - fmt |
31 | | - GIT_REPOSITORY https://github.com/fmtlib/fmt.git |
32 | | - GIT_TAG e69e5f977d458f2650bb346dadf2ad30c5320281 # 10.2.1 |
33 | | - ) |
34 | | - FetchContent_MakeAvailable(fmt) |
35 | | - set_target_properties(fmt PROPERTIES CXX_CLANG_TIDY "") |
36 | | - endif() |
37 | | - set(SPDLOG_FMT_EXTERNAL_HO ON) |
38 | | - # with this spdlog is included as a system library and won't e.g. trigger |
39 | | - # linter warnings |
40 | | - set(SPDLOG_SYSTEM_INCLUDES ON) |
41 | | - |
42 | | - get_property(tmp GLOBAL PROPERTY PACKAGES_NOT_FOUND) |
43 | | - list( |
44 | | - FILTER |
45 | | - tmp |
46 | | - EXCLUDE |
47 | | - REGEX |
48 | | - spdlog |
49 | | - ) |
50 | | - set_property(GLOBAL PROPERTY PACKAGES_NOT_FOUND ${tmp}) |
51 | | - |
52 | | - FetchContent_Declare( |
53 | | - spdlog |
54 | | - GIT_REPOSITORY https://github.com/gabime/spdlog.git |
55 | | - GIT_TAG 27cb4c76708608465c413f6d0e6b8d99a4d84302 # v1.14.1 |
56 | | - ) |
57 | | - set(SPDLOG_INSTALL |
58 | | - ON |
59 | | - CACHE BOOL "Install spdlog" FORCE |
60 | | - ) |
61 | | - FetchContent_MakeAvailable(spdlog) |
62 | | - |
63 | | - set_target_properties( |
64 | | - spdlog |
65 | | - PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" |
66 | | - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" |
67 | | - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
68 | | - ) |
69 | | -endif() |
| 13 | +find_package(spdlog REQUIRED) |
| 14 | +find_package(KDBindings REQUIRED) |
| 15 | +find_package(whereami REQUIRED) |
| 16 | +find_package(mio REQUIRED) |
70 | 17 |
|
71 | | -# KDBindings library |
72 | | -find_package(KDBindings QUIET) |
73 | | -if(NOT TARGET KDAB::KDBindings) |
74 | | - fetchcontent_declare( |
75 | | - KDBindings |
76 | | - GIT_REPOSITORY https://github.com/KDAB/KDBindings.git |
77 | | - GIT_TAG efb54c58c3c2fce280d7089617935ec265fe4e2d # v1.1.0 |
78 | | - USES_TERMINAL_DOWNLOAD YES USES_TERMINAL_UPDATE YES |
79 | | - ) |
80 | | - fetchcontent_makeavailable(KDBindings) |
| 18 | +if(KDUTILS_BUILD_MQTT_SUPPORT) |
| 19 | + find_package(mosquitto REQUIRED) |
81 | 20 | endif() |
82 | | - |
83 | | -# whereami library |
84 | | -find_package(Whereami QUIET) |
85 | | -if(NOT TARGET whereami::whereami) |
86 | | - fetchcontent_declare( |
87 | | - whereami |
88 | | - GIT_REPOSITORY https://github.com/gpakosz/whereami |
89 | | - GIT_TAG e4b7ba1be0e9fd60728acbdd418bc7195cdd37e7 # master at 5/July/2021 |
90 | | - ) |
91 | | - fetchcontent_makeavailable(whereami) |
92 | | -endif() |
93 | | - |
94 | | -# mio header-only lib (provides memory mapping for files) |
95 | | -find_package(mio QUIET) |
96 | | -if(NOT TARGET mio::mio) |
97 | | - fetchcontent_declare( |
98 | | - mio |
99 | | - GIT_REPOSITORY https://github.com/mandreyel/mio.git |
100 | | - GIT_TAG 8b6b7d878c89e81614d05edca7936de41ccdd2da # March 3rd 2023 |
101 | | - ) |
102 | | - fetchcontent_makeavailable(mio) |
103 | | -endif() |
104 | | - |
105 | | -# mosquitto library |
106 | | -find_package(Mosquitto QUIET) |
0 commit comments