blob: 7c9e222b3554157df0e7402cb97f8ae5e449770e [file] [log] [blame]
From b38761831670e980a58acb33d611f65255d678ac Mon Sep 17 00:00:00 2001
From: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Date: Fri, 28 Apr 2023 22:46:36 +0200
Subject: [PATCH] Update CMakeLists.txt
Link systemd libraries, to avoid underlinking of tests with
-DWITH_SYSTEMD_SOCKET_ACTIVATION=ON
[ 82%] Linking CXX executable gtest_dlt_daemon_gateway
cd dlt-daemon-2.18.9/obj-x86_64-linux-gnu/tests && /usr/bin/cmake -E cmake_link_script CMakeFiles/gtest_dlt_daemon_gateway.dir/link.txt --verbose=1
/usr/bin/c++ -g -O2 -ffile-prefix-map=dlt-daemon-2.18.9=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -isystem /include -std=gnu++0x -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -rdynamic CMakeFiles/gtest_dlt_daemon_gateway.dir/gtest_dlt_daemon_gateway.cpp.o CMakeFiles/gtest_dlt_daemon_gateway.dir/__/systemd/3rdparty/sd-daemon.c.o -o gtest_dlt_daemon_gateway -Wl,-rpath,dlt-daemon-2.18.9/obj-x86_64-linux-gnu/src/daemon ../src/daemon/libdlt_daemon.so /usr/lib/x86_64-linux-gnu/libgtest.a /usr/lib/x86_64-linux-gnu/libgtest_main.a -lrt /usr/lib/x86_64-linux-gnu/libgtest.a
/usr/bin/ld: ../src/daemon/libdlt_daemon.so: undefined reference to `sd_listen_fds_with_names'
---
Upstream-Status: Pending
tests/CMakeLists.txt | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 579d7308..3155ca9a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -21,8 +21,16 @@ else()
set(LIBRARIES socket)
endif()
+if(WITH_SYSTEMD_JOURNAL)
+ if(SYSTEMD_VERSION LESS 209)
+ set(SYSTEMD_LIBS systemd-journal systemd-id128)
+ else(SYSTEMD_VERSION LESS 209)
+ set(SYSTEMD_LIBS systemd)
+ endif(SYSTEMD_VERSION LESS 209)
+endif(WITH_SYSTEMD_JOURNAL)
+
set(DLT_LIBRARIES dlt ${GTEST_LIBS} ${LIBRARIES})
-set(DLT_DAEMON_LIBRARIES dlt_daemon ${GTEST_LIBS} ${LIBRARIES})
+set(DLT_DAEMON_LIBRARIES dlt_daemon ${GTEST_LIBS} ${LIBRARIES} ${SYSTEMD_LIBS})
set(DLT_CONTROL_LIBRARIES dlt dlt_control_common_lib ${GTEST_LIBS})
#Receiver used for QTs. add_test() is not required