I want to start/stop a systemd service from within my C++ project. Therefore I like to use the systemd lib and headers provided. I'm using cmake for makefile generation. I'm trying to get systemd in cmake via
pkg_check_modules(SDBUS REQUIRED systemd)
which actually works as
message(STATUS "FOUND" ${SDBUS_FOUND}) returns 1.
However, all the other necessary vars created by cmake like
message(STATUS "LIBS" ${SDBUS_LIBRARIES})
message(STATUS "LIB_DIRS" ${SDBUS_LIBRARY_DIRS})
message(STATUS "LDFLAGS" ${SDBUS_LDFLAGS})
message(STATUS "LDFLAGS_OTHER" ${SDBUS_LDFLAGS_OTHER})
message(STATUS "INCLUDE DIRS" ${SDBUS_INCLUDE_DIRS})
message(STATUS "CFLAGS" ${SDBUS_CFLAGS})
message(STATUS "CFLAGS_OTHER" ${SDBUS_CFLAGS_OTHER})
are empty. Which leads to a linker error when compiling the project. Indeed when calling
pkg-config --libs systemd
it's empty as well. Anyone has any idea on how to solve that and why all these information is not available for systemd?
You should use
pkg_check_modules(SDBUS REQUIRED libsystemd)
Note the extra 'lib' prefix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With