blob: f4ab7f1ad92c278a02c7507b40b944a58f87fb67 [file] [log] [blame]
Tomáš Pecka9fa5f6a2021-04-13 11:36:11 +02001cmake_minimum_required(VERSION 3.19)
Tomáš Pecka698fabc2023-04-07 10:14:07 +02002project(velia LANGUAGES CXX)
Tomáš Pecka9fa5f6a2021-04-13 11:36:11 +02003cmake_policy(SET CMP0109 NEW)
Tomáš Pecka5123e002020-06-05 15:29:21 +02004
5# Build options
Václav Kubernátb332d982021-04-16 01:40:11 +02006set(CMAKE_CXX_STANDARD 20)
Tomáš Pecka5123e002020-06-05 15:29:21 +02007set(CMAKE_CXX_STANDARD_REQUIRED ON)
8
9set(CMAKE_CXX_FLAGS_DEBUG "-Werror ${CMAKE_CXX_FLAGS_DEBUG}")
Václav Kubernátd4b8a692021-04-16 01:21:44 +020010set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Woverloaded-virtual -Wimplicit-fallthrough ${CMAKE_CXX_FLAGS}")
Tomáš Pecka5123e002020-06-05 15:29:21 +020011if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
12 set(CMAKE_CXX_FLAGS "-Wsuggest-override ${CMAKE_CXX_FLAGS}")
13endif()
14
Tomáš Pecka5d4cf2a2020-07-13 13:19:41 +020015if(CMAKE_CXX_FLAGS MATCHES "-stdlib=libc\\+\\+" AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
16 set(STD_FILESYSTEM_LIBRARY c++fs)
17elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1)
18 set(STD_FILESYSTEM_LIBRARY stdc++fs)
19endif()
20
21
Tomáš Pecka5123e002020-06-05 15:29:21 +020022add_custom_target(velia-version-cmake-ide
23 cmake/ProjectGitVersion.cmake
24 cmake/ProjectGitVersionRunner.cmake
25 )
26include(cmake/ProjectGitVersion.cmake)
27prepare_git_version(VELIA_VERSION "0.0")
28
29find_package(Doxygen)
30option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${DOXYGEN_FOUND})
31
Václav Kubernátde0e4e62021-02-08 17:46:14 +010032find_package(Boost REQUIRED)
Tomáš Pecka5123e002020-06-05 15:29:21 +020033find_package(spdlog REQUIRED)
Tomáš Pecka6a266d82021-11-19 11:35:39 +010034find_package(sdbus-c++ "1.0.0" REQUIRED)
Tomáš Peckaa4336812020-07-24 15:32:58 +020035find_package(PkgConfig)
Tomáš Peckaaf4abff2023-01-18 12:23:53 +010036find_package(fmt "8.0.0" REQUIRED)
Jan Kundrátfee3bea2022-02-15 20:36:08 +010037find_package(nlohmann_json REQUIRED)
Jan Kundrát9e8752a2023-02-02 20:55:39 +010038pkg_check_modules(DOCOPT REQUIRED IMPORTED_TARGET docopt)
Tomáš Peckaa4336812020-07-24 15:32:58 +020039
40pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd)
Tomáš Pecka1f42cfe2020-10-21 18:38:27 +020041if(${SYSTEMD_VERSION} VERSION_EQUAL 245)
42 message(FATAL_ERROR "Systemd 245 has a bug affecting DBus method calls using sdbus-c++. Please see https://github.com/Kistler-Group/sdbus-cpp/issues/106.")
43endif()
Tomáš Pecka070f60d2021-10-13 21:48:14 +020044#TODO: Check patch 20333 active
Tomáš Pecka5123e002020-06-05 15:29:21 +020045
Jan Kundrátb3e99982022-03-18 17:38:20 +010046pkg_check_modules(SYSREPO REQUIRED sysrepo-cpp>=1.1.0 IMPORTED_TARGET sysrepo)
47pkg_check_modules(LIBYANG REQUIRED libyang-cpp>=1.1.0 IMPORTED_TARGET libyang)
Tomáš Pecka2d578c82021-02-23 19:01:35 +010048pkg_check_modules(LIBNL REQUIRED IMPORTED_TARGET libnl-route-3.0)
Tomáš Pecka98ad18d2020-11-13 15:39:55 +010049
Tomáš Peckac927d662020-07-13 11:16:16 +020050include(GNUInstallDirs)
51
Tomáš Pecka261c8862020-11-05 11:23:08 +010052include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/)
53
Tomáš Pecka73a13cc2020-11-17 11:12:19 +010054set(YANG_SRCS
Jan Kundrát7a30cf42022-07-12 22:24:09 +020055 yang/czechlight-system@2022-07-08.yang
Tomáš Pecka73a13cc2020-11-17 11:12:19 +010056 yang/iana-hardware@2018-03-13.yang
Tomáš Pecka73a13cc2020-11-17 11:12:19 +010057 yang/ietf-hardware@2018-03-13.yang
Tomáš Peckaf98ce032021-01-14 13:35:00 +010058 yang/iana-crypt-hash@2014-08-06.yang
59 yang/ietf-inet-types@2013-07-15.yang
60 yang/ietf-netconf-acm@2018-02-14.yang
61 yang/ietf-system@2014-08-06.yang
62 yang/ietf-yang-types@2013-07-15.yang
Tomáš Pecka435ca2a2021-01-27 10:53:48 +010063 yang/ietf-ethertypes@2019-03-04.yang
64 yang/ietf-interfaces@2018-02-20.yang
65 yang/ietf-packet-fields@2019-03-04.yang
Václav Kubernát637fe802021-01-22 02:43:18 +010066 yang/ietf-access-control-list@2019-03-04.yang
Václav Kubernát457d1ad2021-01-22 02:43:18 +010067 yang/czechlight-firewall@2021-01-25.yang
Tomáš Peckadac27d42021-02-22 13:20:05 +010068 yang/czechlight-network@2021-02-22.yang
69 yang/iana-if-type@2017-01-19.yang
70 yang/ietf-ip@2018-02-22.yang
Tomáš Pecka2a4ea7b2021-03-30 17:01:37 +020071 yang/ietf-routing@2018-03-13.yang
72 yang/ietf-ipv4-unicast-routing@2018-03-13.yang
73 yang/ietf-ipv6-unicast-routing@2018-03-13.yang
Tomáš Pecka7acf3922021-08-10 11:16:57 +020074 yang/czechlight-lldp@2020-11-04.yang
75 yang/iana-afn-safi@2013-07-04.yang
Tomáš Pecka6a2334b2022-07-12 13:57:54 +020076 yang/ietf-alarms@2019-09-11.yang
77 yang/velia-alarms@2022-07-12.yang
Tomáš Pecka73a13cc2020-11-17 11:12:19 +010078 )
79
Tomáš Pecka59a148f2023-01-16 19:14:15 +010080# temporary until our CI switches to fmt>=9
81add_compile_definitions(FMT_DEPRECATED_OSTREAM)
82
Tomáš Pecka5123e002020-06-05 15:29:21 +020083# Targets
Tomáš Pecka261c8862020-11-05 11:23:08 +010084# - utils
Tomáš Peckabd828862020-06-15 15:53:35 +020085add_library(velia-utils STATIC
Tomáš Peckaad3247f2023-05-11 15:56:26 +020086 src/utils/alarms.cpp
87 src/utils/alarms.h
Tomáš Peckaa193c032020-06-22 17:33:31 +020088 src/utils/exceptions.cpp
Tomáš Pecka261c8862020-11-05 11:23:08 +010089 src/utils/exceptions.h
Václav Kubernát6d9357e2021-01-28 15:38:24 +010090 src/utils/exec.cpp
91 src/utils/exec.h
Tomáš Pecka491f4f22020-11-05 15:44:00 +010092 src/utils/io.cpp
93 src/utils/io.h
Tomáš Peckaa4336812020-07-24 15:32:58 +020094 src/utils/journal.cpp
Tomáš Pecka261c8862020-11-05 11:23:08 +010095 src/utils/journal.h
Václav Kubernátcbdc98a2021-01-28 13:24:37 +010096 src/utils/libyang.cpp
97 src/utils/libyang.h
Tomáš Pecka261c8862020-11-05 11:23:08 +010098 src/utils/log.h
Václav Kubernát6018f082021-02-11 01:32:18 +010099 src/utils/log.cpp
Tomáš Pecka261c8862020-11-05 11:23:08 +0100100 src/utils/log-fwd.h
Tomáš Pecka5123e002020-06-05 15:29:21 +0200101 src/utils/log-init.cpp
Tomáš Pecka261c8862020-11-05 11:23:08 +0100102 src/utils/log-init.h
Tomáš Peckaba2dc312021-01-23 22:29:11 +0100103 src/utils/sysrepo.cpp
104 src/utils/sysrepo.h
Tomáš Pecka339bc672020-11-11 15:59:03 +0100105 src/utils/time.cpp
106 src/utils/time.h
Tomáš Peckad0337072021-01-25 19:57:00 +0100107 src/utils/waitUntilSignalled.cpp
108 src/utils/waitUntilSignalled.h
Tomáš Pecka5123e002020-06-05 15:29:21 +0200109 )
Tomáš Pecka1eb1f352023-04-14 10:39:56 +0200110target_link_libraries(velia-utils PUBLIC spdlog::spdlog PRIVATE PkgConfig::SYSTEMD PkgConfig::LIBYANG PkgConfig::SYSREPO fmt::fmt PkgConfig::DOCOPT)
Tomáš Peckaa4336812020-07-24 15:32:58 +0200111
Tomáš Pecka261c8862020-11-05 11:23:08 +0100112# - health
113add_library(velia-health STATIC
Tomáš Peckae1f0abd2022-07-13 19:31:13 +0200114 src/health/outputs/AlarmsOutputs.cpp
115 src/health/outputs/AlarmsOutputs.h
Tomáš Pecka261c8862020-11-05 11:23:08 +0100116 src/health/outputs/LedSysfsDriver.cpp
117 src/health/outputs/callables.cpp
118 src/health/State.cpp
Tomáš Pecka1d2b95c2023-05-11 16:01:46 +0200119 src/health/SystemdUnits.cpp
120 src/health/SystemdUnits.h
Tomáš Pecka74b885f2020-06-06 20:02:41 +0200121 )
Tomáš Pecka261c8862020-11-05 11:23:08 +0100122target_link_libraries(velia-health
123 PUBLIC
124 velia-utils
125 Boost::boost
126 SDBusCpp::sdbus-c++
127 ${STD_FILESYSTEM_LIBRARY}
Tomáš Pecka6a2334b2022-07-12 13:57:54 +0200128 PRIVATE
129 PkgConfig::LIBYANG
Tomáš Pecka261c8862020-11-05 11:23:08 +0100130 )
Tomáš Pecka74b885f2020-06-06 20:02:41 +0200131
Tomáš Pecka491f4f22020-11-05 15:44:00 +0100132# - ietf-hardware
133add_library(velia-ietf-hardware STATIC
134 src/ietf-hardware/sysfs/EMMC.cpp
135 src/ietf-hardware/sysfs/EMMC.h
Tomáš Pecka9b1c9672020-11-11 15:24:06 +0100136 src/ietf-hardware/sysfs/HWMon.cpp
137 src/ietf-hardware/sysfs/HWMon.h
Tomáš Pecka339bc672020-11-11 15:59:03 +0100138 src/ietf-hardware/IETFHardware.cpp
139 src/ietf-hardware/IETFHardware.h
Václav Kubernát97e5ea12021-03-24 00:36:57 +0100140 src/ietf-hardware/FspYhPsu.cpp
141 src/ietf-hardware/FspYhPsu.h
Tomáš Pecka50584c52023-04-19 10:17:01 +0200142 src/ietf-hardware/thresholds.h
Tomáš Peckadad552b82023-05-04 20:18:18 +0200143 src/ietf-hardware/thresholds.cpp
Tomáš Pecka50584c52023-04-19 10:17:01 +0200144 src/ietf-hardware/thresholds_fwd.h
Tomáš Pecka491f4f22020-11-05 15:44:00 +0100145 )
146target_link_libraries(velia-ietf-hardware
147 PUBLIC
148 velia-utils
149 ${STD_FILESYSTEM_LIBRARY}
Tomáš Pecka9b1c9672020-11-11 15:24:06 +0100150 Boost::boost
Tomáš Pecka491f4f22020-11-05 15:44:00 +0100151 )
Tomáš Pecka491f4f22020-11-05 15:44:00 +0100152
Tomáš Pecka98ad18d2020-11-13 15:39:55 +0100153add_library(velia-ietf-hardware-sysrepo STATIC
Tomáš Pecka98ad18d2020-11-13 15:39:55 +0100154 src/ietf-hardware/sysrepo/Sysrepo.cpp
155 src/ietf-hardware/sysrepo/Sysrepo.h
156 )
157target_link_libraries(velia-ietf-hardware-sysrepo
158 PUBLIC
159 velia-utils
160 PkgConfig::SYSREPO
161 PkgConfig::LIBYANG
162 )
Tomáš Pecka5123e002020-06-05 15:29:21 +0200163
Václav Kubernát6d9357e2021-01-28 15:38:24 +0100164set(NOBODY_UID 65534 CACHE STRING "UID which refers to 'nobody'. Used for dropping root privileges.")
165set(NOBODY_GID 65534 CACHE STRING "GID which refers to 'nobody'. Used for dropping root privileges.")
166
Václav Kubernátde0e4e62021-02-08 17:46:14 +0100167if(NOT NFT_EXECUTABLE)
168 find_program(NFT_EXECUTABLE nft)
169endif()
Václav Kubernátbabbab92021-01-27 09:25:05 +0100170if(NOT SSH_KEYGEN_EXECUTABLE)
171 find_program(SSH_KEYGEN_EXECUTABLE ssh-keygen)
172endif()
173if(NOT CHPASSWD_EXECUTABLE)
174 find_program(CHPASSWD_EXECUTABLE chpasswd)
175endif()
Tomáš Pecka879a6032021-02-03 17:21:48 +0100176if(NOT SYSTEMCTL_EXECUTABLE)
177 find_program(SYSTEMCTL_EXECUTABLE systemctl)
178endif()
Tomáš Pecka5c19e722021-02-15 20:41:29 +0100179if(NOT NETWORKCTL_EXECUTABLE)
180 find_program(NETWORKCTL_EXECUTABLE networkctl)
181endif()
Václav Kubernát566c9402021-02-10 08:33:54 +0100182if(NOT HOSTNAMECTL_EXECUTABLE)
183 find_program(HOSTNAMECTL_EXECUTABLE hostnamectl)
184endif()
Václav Kubernátbabbab92021-01-27 09:25:05 +0100185
186set(VELIA_AUTHORIZED_KEYS_FORMAT "{HOME}/.ssh/authorized_keys" CACHE STRING "pattern for determining path to users' SSH authorized_keys file. Must at least one of '{USER}' or '{HOME}' which will get replaced by the name of the user and the home directory of the user respectively.")
187if(NOT VELIA_AUTHORIZED_KEYS_FORMAT)
188 message(FATAL_ERROR "VELIA_AUTHORIZED_KEYS_FORMAT not set.")
189endif()
190
191if(NOT VELIA_AUTHORIZED_KEYS_FORMAT MATCHES "{USER}" AND NOT VELIA_AUTHORIZED_KEYS_FORMAT MATCHES "{HOME}")
192 message(FATAL_ERROR "Wrong format string given for VELIA_AUTHORIZED_KEYS_FORMAT: at least one of {USER} or {HOME} expected.")
193endif()
194
195set(VELIA_REAL_ETC_PASSWD "/etc/passwd" CACHE STRING "Path to passwd file")
196if(NOT VELIA_REAL_ETC_PASSWD)
197 message(FATAL_ERROR "VELIA_REAL_ETC_PASSWD not set")
198endif()
199
200set(VELIA_REAL_ETC_SHADOW "/etc/shadow" CACHE STRING "Path to shadow file")
201if(NOT VELIA_REAL_ETC_SHADOW)
202 message(FATAL_ERROR "VELIA_REAL_ETC_SHADOW not set")
203endif()
204
205set(VELIA_BACKUP_ETC_SHADOW "/etc/shadow" CACHE STRING "Path to where /etc/shadow gets copied to upon each change")
206if(NOT VELIA_BACKUP_ETC_SHADOW)
207 message(FATAL_ERROR "VELIA_BACKUP_ETC_SHADOW not set")
208endif()
Václav Kubernátde0e4e62021-02-08 17:46:14 +0100209
Václav Kubernát566c9402021-02-10 08:33:54 +0100210set(VELIA_BACKUP_ETC_HOSTNAME "/etc/hostname" CACHE STRING "Path to hostname file")
211if(NOT VELIA_BACKUP_ETC_HOSTNAME )
212 message(FATAL_ERROR "VELIA_BACKUP_ETC_HOSTNAME not set")
213endif()
214
Václav Kubernát6d9357e2021-01-28 15:38:24 +0100215configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/system/system_vars.h.in ${CMAKE_CURRENT_BINARY_DIR}/system_vars.h @ONLY)
216include_directories(${CMAKE_CURRENT_BINARY_DIR})
217
Tomáš Pecka292bc9c2021-01-11 22:03:11 +0100218# - ietf-system
219add_library(velia-system STATIC
Tomáš Pecka991e4d52021-01-11 10:03:14 +0100220 src/system/RAUC.cpp
221 src/system/RAUC.h
Tomáš Pecka594a6762021-01-29 11:06:08 +0100222 src/system/Firmware.cpp
223 src/system/Firmware.h
Tomáš Peckaf976c5b2021-01-23 21:19:52 +0100224 src/system/IETFSystem.cpp
225 src/system/IETFSystem.h
Václav Kubernátbabbab92021-01-27 09:25:05 +0100226 src/system/Authentication.cpp
227 src/system/Authentication.h
Tomáš Pecka2d578c82021-02-23 19:01:35 +0100228 src/system/Rtnetlink.cpp
229 src/system/Rtnetlink.h
Tomáš Peckaf10b9302021-02-23 19:02:02 +0100230 src/system/IETFInterfaces.cpp
231 src/system/IETFInterfaces.h
Tomáš Pecka39bbb512021-05-23 22:07:22 +0200232 src/system/IETFInterfacesConfig.cpp
233 src/system/IETFInterfacesConfig.h
Tomáš Peckaaf7b7042021-04-20 20:14:13 +0200234 src/system/LED.cpp
235 src/system/LED.h
Tomáš Pecka7acf3922021-08-10 11:16:57 +0200236 src/system/LLDP.cpp
237 src/system/LLDP.h
238 src/system/LLDPCallback.cpp
239 src/system/LLDPCallback.h
Tomáš Pecka292bc9c2021-01-11 22:03:11 +0100240 )
241target_link_libraries(velia-system
242 PUBLIC
243 velia-utils
244 PkgConfig::SYSREPO
245 PkgConfig::LIBYANG
Tomáš Pecka2d578c82021-02-23 19:01:35 +0100246 PkgConfig::LIBNL
Václav Kubernát6dd52c82021-01-21 08:38:42 +0100247 SDBusCpp::sdbus-c++
Jan Kundrátfee3bea2022-02-15 20:36:08 +0100248 nlohmann_json::nlohmann_json
Tomáš Pecka292bc9c2021-01-11 22:03:11 +0100249 )
250
Václav Kubernátd386aba2021-01-19 10:03:28 +0100251# - firewall
252add_library(velia-firewall STATIC
253 src/firewall/Firewall.cpp
254 )
255target_link_libraries(velia-firewall
256 PUBLIC
257 velia-utils
258 PkgConfig::SYSREPO
259 PRIVATE
260 PkgConfig::LIBYANG
261 )
262
263
Tomáš Pecka625b7a12021-01-23 20:55:51 +0100264# - daemons
Tomáš Peckacd19e622021-01-27 09:18:11 +0100265add_executable(veliad-health
266 src/main-health.cpp
Tomáš Pecka139e3612021-01-25 19:49:00 +0100267 src/health/Factory.cpp
268 src/health/Factory.h
269 )
Tomáš Peckacd19e622021-01-27 09:18:11 +0100270target_link_libraries(veliad-health
Tomáš Peckaaae9fe32021-01-25 19:57:22 +0100271 PUBLIC
Tomáš Peckad03044f2020-11-12 14:33:10 +0100272 velia-health
Jan Kundrát9e8752a2023-02-02 20:55:39 +0100273 PkgConfig::DOCOPT
Tomáš Peckaaae9fe32021-01-25 19:57:22 +0100274 )
Tomáš Peckacd19e622021-01-27 09:18:11 +0100275add_dependencies(veliad-health target-VELIA_VERSION)
276target_include_directories(veliad-health PUBLIC ${CMAKE_BINARY_DIR})
Tomáš Peckad03044f2020-11-12 14:33:10 +0100277
Tomáš Pecka625b7a12021-01-23 20:55:51 +0100278add_executable(veliad-system
279 src/main-system.cpp
280 )
281target_link_libraries(veliad-system
282 PUBLIC
283 velia-system
Jan Kundrát9e8752a2023-02-02 20:55:39 +0100284 PkgConfig::DOCOPT
Tomáš Pecka625b7a12021-01-23 20:55:51 +0100285 )
286add_dependencies(veliad-system target-VELIA_VERSION)
287target_include_directories(veliad-system PUBLIC ${CMAKE_BINARY_DIR})
288
Václav Kubernátd386aba2021-01-19 10:03:28 +0100289add_executable(veliad-firewall
290 src/main-firewall.cpp
291 )
292target_link_libraries(veliad-firewall
293 PUBLIC
294 velia-firewall
295 velia-utils
Jan Kundrát9e8752a2023-02-02 20:55:39 +0100296 PkgConfig::DOCOPT
Václav Kubernátd386aba2021-01-19 10:03:28 +0100297 )
298add_dependencies(veliad-firewall target-VELIA_VERSION)
299target_include_directories(veliad-firewall PUBLIC ${CMAKE_BINARY_DIR})
300
Tomáš Peckaaae9fe32021-01-25 19:57:22 +0100301add_executable(veliad-hardware
302 src/main-hardware.cpp
303 src/ietf-hardware/Factory.cpp
304 src/ietf-hardware/Factory.h
305 )
306target_link_libraries(veliad-hardware
307 PUBLIC
308 velia-ietf-hardware
309 velia-ietf-hardware-sysrepo
Jan Kundrát9e8752a2023-02-02 20:55:39 +0100310 PkgConfig::DOCOPT
Tomáš Peckaaae9fe32021-01-25 19:57:22 +0100311 )
312add_dependencies(veliad-hardware target-VELIA_VERSION)
313target_include_directories(veliad-hardware PUBLIC ${CMAKE_BINARY_DIR})
314
Tomáš Pecka5123e002020-06-05 15:29:21 +0200315# Testing
Tomáš Peckaa06d74d2020-06-14 18:18:13 +0200316include(CTest)
Tomáš Pecka5123e002020-06-05 15:29:21 +0200317if(BUILD_TESTING)
Tomáš Pecka5123e002020-06-05 15:29:21 +0200318 find_package(trompeloeil 33 REQUIRED)
319 find_package(doctest 2.3.1 REQUIRED)
320
Tomáš Peckaefd88432020-06-17 15:31:39 +0200321 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/configure.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/tests/configure.cmake.h)
322
Tomáš Pecka5123e002020-06-05 15:29:21 +0200323 add_library(DoctestIntegration STATIC
Tomáš Pecka261c8862020-11-05 11:23:08 +0100324 tests/doctest_integration.cpp
325 tests/trompeloeil_doctest.h
326 tests/wait-a-bit-longer.cpp
327 )
Václav Kubernát7efd6d52021-11-09 01:31:11 +0100328 target_link_libraries(DoctestIntegration doctest::doctest spdlog::spdlog)
Tomáš Pecka261c8862020-11-05 11:23:08 +0100329 target_include_directories(DoctestIntegration PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tests/)
Tomáš Pecka5123e002020-06-05 15:29:21 +0200330 target_compile_definitions(DoctestIntegration PUBLIC DOCTEST_CONFIG_SUPER_FAST_ASSERTS)
331
Tomáš Peckaa18702d2021-01-25 18:07:23 +0100332 add_library(SysrepoTesting STATIC
333 tests/mock/sysrepo/events.cpp
334 tests/mock/sysrepo/events.h
Tomáš Pecka0ed5f4f2023-05-17 12:20:23 +0200335 tests/mock/ietf_hardware.h
336 tests/mock/system.h
Tomáš Peckaa18702d2021-01-25 18:07:23 +0100337 )
338 target_link_libraries(SysrepoTesting DoctestIntegration PkgConfig::SYSREPO)
339
Tomáš Pecka0a2e8902020-06-09 21:11:20 +0200340 add_library(DbusTesting STATIC
Tomáš Pecka991e4d52021-01-11 10:03:14 +0100341 tests/dbus-helpers/dbus_rauc_server.cpp
342 tests/dbus-helpers/dbus_rauc_server.h
Tomáš Pecka79344c82021-09-16 18:25:59 +0200343 tests/dbus-helpers/dbus_resolve1_server.cpp
344 tests/dbus-helpers/dbus_resolve1_server.h
Tomáš Pecka0a2e8902020-06-09 21:11:20 +0200345 tests/dbus-helpers/dbus_semaphore_server.cpp
Tomáš Pecka261c8862020-11-05 11:23:08 +0100346 tests/dbus-helpers/dbus_semaphore_server.h
Tomáš Peckaccd80c32020-06-22 14:44:32 +0200347 tests/dbus-helpers/dbus_systemd_server.cpp
Tomáš Pecka261c8862020-11-05 11:23:08 +0100348 tests/dbus-helpers/dbus_systemd_server.h
349 )
350 target_link_libraries(DbusTesting
351 PUBLIC
352 velia-utils
353 SDBusCpp::sdbus-c++
354 )
Tomáš Pecka0a2e8902020-06-09 21:11:20 +0200355
Tomáš Pecka9b1c9672020-11-11 15:24:06 +0100356 add_library(FsTestUtils STATIC
357 tests/fs-helpers/FileInjector.cpp
358 tests/fs-helpers/FileInjector.h
359 tests/fs-helpers/utils.cpp
360 tests/fs-helpers/utils.h
361 )
362 target_link_libraries(FsTestUtils
363 PUBLIC
364 ${STD_FILESYSTEM_LIBRARY}
365 )
366
Václav Kubernát5a745d22021-11-12 12:09:57 +0100367 find_program(SYSREPOCTL sysrepoctl)
368 find_program(SYSREPOCFG sysrepocfg)
Tomáš Pecka174cc842023-02-02 14:52:12 +0100369 find_program(IPROUTE2_EXECUTABLE ip REQUIRED)
Tomáš Pecka174cc842023-02-02 14:52:12 +0100370 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/test_vars.h.in ${CMAKE_CURRENT_BINARY_DIR}/test_vars.h @ONLY)
Václav Kubernát5a745d22021-11-12 12:09:57 +0100371
Tomáš Pecka174cc842023-02-02 14:52:12 +0100372 function(velia_test)
373 cmake_parse_arguments(TEST "" "NAME;FIXTURE;RESOURCE_LOCK" "LIBRARIES;COMMAND" ${ARGN})
374
375 add_executable(test-${TEST_NAME} ${CMAKE_SOURCE_DIR}/tests/${TEST_NAME}.cpp)
376 target_link_libraries(test-${TEST_NAME} DoctestIntegration ${TEST_LIBRARIES})
377 target_include_directories(test-${TEST_NAME}
Tomáš Pecka261c8862020-11-05 11:23:08 +0100378 PUBLIC
379 ${CMAKE_CURRENT_SOURCE_DIR}
380 PRIVATE
381 ${CMAKE_BINARY_DIR}
382 )
Tomáš Pecka5123e002020-06-05 15:29:21 +0200383
384 if(NOT CMAKE_CROSSCOMPILING)
Tomáš Pecka3bb769e2023-02-02 17:11:46 +0100385 if(NOT(TEST_COMMAND))
386 add_test(test-${TEST_NAME} test-${TEST_NAME})
387 else()
388 add_test(NAME test-${TEST_NAME} COMMAND ${TEST_COMMAND})
389 endif()
Tomáš Pecka5123e002020-06-05 15:29:21 +0200390 endif()
Tomáš Pecka5123e002020-06-05 15:29:21 +0200391
Tomáš Pecka174cc842023-02-02 14:52:12 +0100392 set(test_name_init sysrepo:prep:${TEST_NAME})
393 set(test_name_cleanup sysrepo:clean:${TEST_NAME})
394 set(fixture_name sysrepo:env:${TEST_NAME})
395
396 if(TEST_RESOURCE_LOCK)
397 set_tests_properties(test-${TEST_NAME} PROPERTIES RESOURCE_LOCK "${TEST_RESOURCE_LOCK}")
398 endif()
Tomáš Pecka98ad18d2020-11-13 15:39:55 +0100399
Václav Kubernát5a745d22021-11-12 12:09:57 +0100400 # How to do this:
Tomáš Pecka174cc842023-02-02 14:52:12 +0100401 # take the args for manage module from variable "fixture{fixture_name}"
Václav Kubernát5a745d22021-11-12 12:09:57 +0100402 # and then add set env vars for sysrepo
403 # set them ALSO for the init/cleanup tests
Tomáš Pecka174cc842023-02-02 14:52:12 +0100404 if(TEST_FIXTURE)
405 add_test(NAME ${test_name_init} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepoctl-manage-module.sh ${SYSREPOCTL} ${SYSREPOCFG} prepare ${${TEST_FIXTURE}})
Václav Kubernát5a745d22021-11-12 12:09:57 +0100406 set_tests_properties(${test_name_init} PROPERTIES FIXTURES_SETUP ${fixture_name})
Tomáš Pecka174cc842023-02-02 14:52:12 +0100407 add_test(NAME ${test_name_cleanup} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepoctl-manage-module.sh ${SYSREPOCTL} ${SYSREPOCFG} uninstall ${${TEST_FIXTURE}})
Václav Kubernát5a745d22021-11-12 12:09:57 +0100408 set_tests_properties(${test_name_cleanup} PROPERTIES FIXTURES_CLEANUP ${fixture_name})
Tomáš Pecka98ad18d2020-11-13 15:39:55 +0100409
Tomáš Pecka174cc842023-02-02 14:52:12 +0100410 set_tests_properties(test-${TEST_NAME} PROPERTIES FIXTURES_REQUIRED ${fixture_name})
411 set_property(TEST test-${TEST_NAME} ${test_name_init} ${test_name_cleanup} APPEND PROPERTY ENVIRONMENT
412 "SYSREPO_REPOSITORY_PATH=${CMAKE_CURRENT_BINARY_DIR}/test_repositories/test_${TEST_NAME}"
413 "SYSREPO_SHM_PREFIX=velia_test_${TEST_NAME}"
Václav Kubernát5a745d22021-11-12 12:09:57 +0100414 )
Václav Kubernát5a745d22021-11-12 12:09:57 +0100415 endif()
Tomáš Pecka98ad18d2020-11-13 15:39:55 +0100416 endfunction()
417
Tomáš Pecka0f85ab62023-02-02 14:53:14 +0100418 find_program(YANGLINT_PATH yanglint)
419 if (NOT YANGLINT_PATH)
420 message(FATAL_ERROR "Cannot find libyang's yanglint")
421 endif()
422 foreach(yang_file ${YANG_SRCS})
423 add_test(NAME yang-tree:${yang_file} COMMAND ${YANGLINT_PATH} -f tree ${CMAKE_CURRENT_SOURCE_DIR}/${yang_file})
424 endforeach()
425
Tomáš Pecka174cc842023-02-02 14:52:12 +0100426 velia_test(NAME system_rauc LIBRARIES velia-system DbusTesting RESOURCE_LOCK dbus-rauc)
427 velia_test(NAME system_lldp LIBRARIES velia-system DbusTesting)
Tomáš Pecka991e4d52021-01-11 10:03:14 +0100428
Tomáš Pecka50584c52023-04-19 10:17:01 +0200429 velia_test(NAME hardware_thresholds LIBRARIES velia-ietf-hardware)
Tomáš Pecka174cc842023-02-02 14:52:12 +0100430 velia_test(NAME hardware_emmc LIBRARIES velia-ietf-hardware FsTestUtils)
431 velia_test(NAME hardware_hwmon LIBRARIES velia-ietf-hardware FsTestUtils)
Tomáš Pecka3649ae12023-04-14 10:40:56 +0200432 velia_test(NAME hardware_fspyhpsu LIBRARIES velia-ietf-hardware FsTestUtils)
Tomáš Pecka3f811962023-04-14 10:54:32 +0200433 velia_test(NAME hardware_ietf-hardware LIBRARIES velia-ietf-hardware)
Tomáš Pecka7acf3922021-08-10 11:16:57 +0200434
Václav Kubernát5a745d22021-11-12 12:09:57 +0100435 set(fixture_sysrepo-czechlight-lldp YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-lldp@2020-11-04.yang)
Tomáš Pecka174cc842023-02-02 14:52:12 +0100436 velia_test(NAME sysrepo_system-lldp LIBRARIES velia-system DbusTesting FIXTURE fixture_sysrepo-czechlight-lldp)
Tomáš Pecka83b62e12020-12-16 14:50:49 +0100437
Václav Kubernát5a745d22021-11-12 12:09:57 +0100438 set(fixture_sysrepo-ietf-system YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-system@2014-08-06.yang)
Tomáš Pecka174cc842023-02-02 14:52:12 +0100439 velia_test(NAME sysrepo_system-ietfsystem LIBRARIES velia-system DbusTesting FIXTURE fixture_sysrepo-ietf-system)
Tomáš Peckacb7a5f82021-01-20 15:12:00 +0100440
Jan Kundrát7a30cf42022-07-12 22:24:09 +0200441 set(fixture_sysrepo-czechlight-system YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-system@2022-07-08.yang)
Tomáš Pecka174cc842023-02-02 14:52:12 +0100442 velia_test(NAME sysrepo_system-firmware LIBRARIES velia-system DbusTesting SysrepoTesting FIXTURE fixture_sysrepo-czechlight-system RESOURCE_LOCK dbus-rauc)
443 velia_test(NAME sysrepo_authentication LIBRARIES velia-system FsTestUtils FIXTURE fixture_sysrepo-czechlight-system)
444 velia_test(NAME sysrepo_system-leds LIBRARIES velia-system FsTestUtils FIXTURE fixture_sysrepo-czechlight-system)
Tomáš Peckaaf7b7042021-04-20 20:14:13 +0200445
Václav Kubernát5a745d22021-11-12 12:09:57 +0100446 set(fixture_sysrepo-czechlight-network
Tomáš Peckaf10b9302021-02-23 19:02:02 +0100447 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/iana-if-type@2017-01-19.yang
448 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-interfaces@2018-02-20.yang
449 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ip@2018-02-22.yang
Tomáš Pecka2a4ea7b2021-03-30 17:01:37 +0200450 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-routing@2018-03-13.yang
451 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ipv4-unicast-routing@2018-03-13.yang
452 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ipv6-unicast-routing@2018-03-13.yang
Tomáš Peckaf10b9302021-02-23 19:02:02 +0100453 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-network@2021-02-22.yang)
Jan Kundrátf1af3182023-02-08 21:55:15 +0100454 velia_test(NAME sysrepo_interfaces-systemd-networkd LIBRARIES velia-system FIXTURE fixture_sysrepo-czechlight-network)
Tomáš Peckaf10b9302021-02-23 19:02:02 +0100455
Tomáš Peckafd5ec7b2023-02-02 18:48:37 +0100456 find_program(UNSHARE_EXECUTABLE unshare REQUIRED)
Jan Kundrátcb93e662023-02-08 17:39:06 +0100457 find_program(MOUNT_EXECUTABLE mount REQUIRED)
Tomáš Peckafd5ec7b2023-02-02 18:48:37 +0100458 pkg_get_variable(SR_GROUP sysrepo SR_GROUP)
459 if (SR_GROUP)
460 set(UNSHARE_MAP_GROUP_ARG "--map-group=${SR_GROUP}")
461 else()
462 set(UNSHARE_MAP_GROUP_ARG "")
Tomáš Pecka9fa5f6a2021-04-13 11:36:11 +0200463 endif()
Jan Kundrátd16357d2023-02-08 21:57:57 +0100464 velia_test(NAME sysrepo_interfaces-libnl LIBRARIES velia-system FIXTURE fixture_sysrepo-czechlight-network
465 COMMAND ${UNSHARE_EXECUTABLE} --net --mount --map-root-user ${UNSHARE_MAP_GROUP_ARG} sh -c "set -ex $<SEMICOLON> ${MOUNT_EXECUTABLE} -t sysfs none /sys $<SEMICOLON> $<TARGET_FILE:test-sysrepo_interfaces-libnl>")
Tomáš Pecka55f64f82020-12-10 19:03:30 +0100466
Tomáš Pecka2117ce52023-05-12 11:28:34 +0200467 set(fixture_sysrepo-ietf-hardware
468 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/iana-hardware@2018-03-13.yang
469 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-hardware@2018-03-13.yang FEATURE hardware-sensor FEATURE hardware-state
470 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-alarms@2019-09-11.yang FEATURE alarm-shelving FEATURE alarm-summary
471 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/velia-alarms@2022-07-12.yang
472 YANG ${CMAKE_CURRENT_SOURCE_DIR}/tests/yang/sysrepo-ietf-alarms@2022-02-17.yang)
Tomáš Pecka3f811962023-04-14 10:54:32 +0200473 velia_test(NAME sysrepo_ietf-hardware LIBRARIES velia-ietf-hardware velia-ietf-hardware-sysrepo FsTestUtils FIXTURE fixture_sysrepo-ietf-hardware)
Tomáš Pecka174cc842023-02-02 14:52:12 +0100474
Tomáš Pecka83b62e12020-12-16 14:50:49 +0100475 # ctest dance for sysrepo_two-daemons: compile daemon, create a fixture for test, add the test into the fixture
Tomáš Pecka55f64f82020-12-10 19:03:30 +0100476 add_executable(test-sysrepo_test_merge-daemon ${CMAKE_SOURCE_DIR}/tests/sysrepo_two-daemons_daemon.cpp)
477 target_link_libraries(test-sysrepo_test_merge-daemon PkgConfig::SYSREPO PkgConfig::LIBYANG)
Tomáš Pecka174cc842023-02-02 14:52:12 +0100478 velia_test(NAME sysrepo_two-daemons LIBRARIES velia-ietf-hardware-sysrepo FIXTURE fixture_sysrepo-ietf-hardware)
Tomáš Pecka55f64f82020-12-10 19:03:30 +0100479
480 add_test(NAME sysrepo_test_merge-start COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_two-daemons_control.sh start)
481 add_test(NAME sysrepo_test_merge-stop COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_two-daemons_control.sh stop)
Václav Kubernát5a745d22021-11-12 12:09:57 +0100482 set_tests_properties(sysrepo_test_merge-start PROPERTIES FIXTURES_SETUP sysrepo:two-daemons)
483 set_tests_properties(sysrepo_test_merge-stop PROPERTIES FIXTURES_CLEANUP sysrepo:two-daemons)
484 set_property(TEST sysrepo_test_merge-start sysrepo_test_merge-stop APPEND PROPERTY ENVIRONMENT
485 "SYSREPO_REPOSITORY_PATH=${CMAKE_CURRENT_BINARY_DIR}/test_repositories/test_sysrepo_two-daemons"
486 "SYSREPO_SHM_PREFIX=velia_test_sysrepo_two-daemons"
487 )
Václav Kubernát5a745d22021-11-12 12:09:57 +0100488 set_property(TEST test-sysrepo_two-daemons APPEND PROPERTY FIXTURES_REQUIRED sysrepo:two-daemons)
489
Tomáš Pecka83b62e12020-12-16 14:50:49 +0100490 # ensure we run two-daemons merge test and ietf-hardware test sequentially and don't cleanup before everything ends
Tomáš Pecka3f811962023-04-14 10:54:32 +0200491 set_tests_properties(sysrepo_test_merge-start PROPERTIES DEPENDS test-sysrepo_ietf-hardware)
Václav Kubernát5a745d22021-11-12 12:09:57 +0100492 set_tests_properties(sysrepo:clean:sysrepo_two-daemons PROPERTIES DEPENDS sysrepo_test_merge-stop)
Tomáš Pecka83b62e12020-12-16 14:50:49 +0100493
Václav Kubernát5a745d22021-11-12 12:09:57 +0100494 set(fixture_sysrepo-firewall
Václav Kubernátd386aba2021-01-19 10:03:28 +0100495 # Installing czechlight-firewall automatically installs ietf-access-control-list as implemented (not just
496 # imported) but I still need to install it myself to enable the features.
497 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-access-control-list@2019-03-04.yang
Václav Kubernátd386aba2021-01-19 10:03:28 +0100498 FEATURE match-on-eth
Václav Kubernát2b073632021-11-25 15:39:42 +0100499 FEATURE eth
Václav Kubernátd386aba2021-01-19 10:03:28 +0100500 FEATURE match-on-ipv4
501 FEATURE ipv4
502 FEATURE match-on-ipv6
503 FEATURE ipv6
504 FEATURE mixed-eth-ipv4-ipv6
505 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-firewall@2021-01-25.yang
506 )
507
Tomáš Pecka174cc842023-02-02 14:52:12 +0100508 velia_test(NAME sysrepo-firewall LIBRARIES velia-firewall FIXTURE fixture_sysrepo-firewall)
Tomáš Pecka6a2334b2022-07-12 13:57:54 +0200509
510 set(fixture_sysrepo-alarms
Tomáš Pecka3906c892022-07-26 13:51:17 +0200511 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-alarms@2019-09-11.yang FEATURE alarm-shelving FEATURE alarm-summary
Tomáš Pecka6a2334b2022-07-12 13:57:54 +0200512 YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/velia-alarms@2022-07-12.yang
513 YANG ${CMAKE_CURRENT_SOURCE_DIR}/tests/yang/sysrepo-ietf-alarms@2022-02-17.yang
514 )
Tomáš Pecka3906c892022-07-26 13:51:17 +0200515 velia_test(NAME health_systemd-units LIBRARIES velia-health DbusTesting FIXTURE fixture_sysrepo-alarms)
516 velia_test(NAME sysrepo_health-led-alarms LIBRARIES velia-health DbusTesting FIXTURE fixture_sysrepo-alarms)
Tomáš Peckabe797072022-07-15 20:45:52 +0200517
518 find_program(SYSREPO_IETF_ALARMSD_EXECUTABLE sysrepo-ietf-alarmsd)
519 if(SYSREPO_IETF_ALARMSD_EXECUTABLE)
520 velia_test(NAME sysrepo_ietf-alarms LIBRARIES velia-health DbusTesting FIXTURE fixture_sysrepo-alarms)
521
522 add_test(NAME sysrepo_ietf-alarms-start COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_sysrepo-ietf-alarms_control.sh start ${SYSREPO_IETF_ALARMSD_EXECUTABLE} ${CMAKE_BINARY_DIR}/sysrepo-ietf-alarmsd.log)
523 add_test(NAME sysrepo_ietf-alarms-stop COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_sysrepo-ietf-alarms_control.sh stop)
524 set_property(TEST sysrepo_ietf-alarms-start sysrepo_ietf-alarms-stop test-sysrepo_ietf-alarms APPEND PROPERTY ENVIRONMENT
525 "SYSREPO_REPOSITORY_PATH=${CMAKE_CURRENT_BINARY_DIR}/test_repositories/test_sysrepo_ietf-alarms"
526 "SYSREPO_SHM_PREFIX=velia_test_sysrepo_ietf-alarms"
527 )
528 set_tests_properties(sysrepo_ietf-alarms-start PROPERTIES FIXTURES_SETUP sysrepo-ietf-alarmsd)
529 set_tests_properties(sysrepo_ietf-alarms-stop PROPERTIES FIXTURES_CLEANUP sysrepo-ietf-alarmsd)
530 set_property(TEST test-sysrepo_ietf-alarms APPEND PROPERTY FIXTURES_REQUIRED sysrepo-ietf-alarmsd)
531
532 set_tests_properties(sysrepo_ietf-alarms-start PROPERTIES DEPENDS sysrepo:prep:sysrepo_ietf-alarms)
533 set_tests_properties(sysrepo:clean:sysrepo_ietf-alarms PROPERTIES DEPENDS sysrepo_ietf-alarms-stop)
534 endif()
Tomáš Pecka261c8862020-11-05 11:23:08 +0100535endif()
Tomáš Peckac927d662020-07-13 11:16:16 +0200536
Tomáš Pecka5123e002020-06-05 15:29:21 +0200537if(WITH_DOCS)
538 set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
539 set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
540 configure_file(${doxyfile_in} ${doxyfile} @ONLY)
541 add_custom_target(doc
542 COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
543 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
544 COMMENT "Generating API documentation with Doxygen"
545 VERBATIM
546 SOURCES ${doxyfile_in}
547 )
Tomáš Peckaa06d74d2020-06-14 18:18:13 +0200548endif()
Tomáš Pecka261c8862020-11-05 11:23:08 +0100549
Tomáš Pecka73a13cc2020-11-17 11:12:19 +0100550set(YANG_DIR ${CMAKE_INSTALL_PREFIX}/share/velia/yang)
551install(FILES ${YANG_SRCS} DESTINATION ${YANG_DIR})
Tomáš Peckaeb317722021-04-13 21:33:20 +0200552install(FILES ${CMAKE_SOURCE_DIR}/yang/ietf-ipv6-router-advertisements@2018-03-13.yang DESTINATION ${YANG_DIR})
Tomáš Peckacd19e622021-01-27 09:18:11 +0100553install(TARGETS veliad-health RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/)
Tomáš Pecka625b7a12021-01-23 20:55:51 +0100554install(TARGETS veliad-system RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/)
Tomáš Peckaaae9fe32021-01-25 19:57:22 +0100555install(TARGETS veliad-hardware RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/)
Tomáš Peckafb14b182021-01-27 10:54:00 +0100556install(TARGETS veliad-firewall RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/)