diff --git a/README.md b/README.md index 1ffc81d..5fe4a05 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,10 @@ $ sudo cmake --build . --target install Defines version of systemd to be downloaded, built and integrated into sdbus-c++. Default value: `242`. + * `LIBSYSTEMD_EXTRA_CONFIG_OPTS` [string] + + Additional options to be passed as-is to the libsystemd build system (meson for systemd v242) in its configure step. Can be used for passing e.g. toolchain file path in case of cross builds. Default value: empty. + * `CMAKE_BUILD_TYPE` [string] This is a CMake-builtin option. Set to `Release` to build sdbus-c++ for production use. Set to `Debug` if you want to help further develop (and debug) the library :) diff --git a/cmake/LibsystemdExternalProject.cmake b/cmake/LibsystemdExternalProject.cmake index e720e88..09dd102 100644 --- a/cmake/LibsystemdExternalProject.cmake +++ b/cmake/LibsystemdExternalProject.cmake @@ -6,6 +6,10 @@ if((NOT MESON) OR (NOT NINJA)) message(FATAL_ERROR "Meson and Ninja are required to build libsystemd") endif() +if(NOT GPERF) + message(WARNING "gperf was not found, libsystemd configuration may fail") +endif() + find_library(GLIBC_RT_LIBRARY rt) find_package(PkgConfig REQUIRED) pkg_check_modules(MOUNT mount) @@ -15,6 +19,7 @@ if (NOT CAP_FOUND) endif() set(LIBSYSTEMD_VERSION "242" CACHE STRING "libsystemd version (>=239) to build and incorporate into libsdbus-c++") +set(LIBSYSTEMD_EXTRA_CONFIG_OPTS "" CACHE STRING "Additional configuration options to be passed as-is to libsystemd build system") if(NOT CMAKE_BUILD_TYPE) set(LIBSYSTEMD_BUILD_TYPE "plain") @@ -41,7 +46,7 @@ ExternalProject_Add(LibsystemdBuildProject GIT_SHALLOW 1 UPDATE_COMMAND "" CONFIGURE_COMMAND ${CMAKE_COMMAND} -E remove /* - COMMAND ${MESON} --prefix= --buildtype=${LIBSYSTEMD_BUILD_TYPE} -Dstatic-libsystemd=pic -Dselinux=false + COMMAND ${MESON} --prefix= --buildtype=${LIBSYSTEMD_BUILD_TYPE} -Dstatic-libsystemd=pic -Dselinux=false ${LIBSYSTEMD_EXTRA_CONFIG_OPTS} BUILD_COMMAND ${BUILD_VERSION_H} COMMAND ${NINJA} -C libsystemd.a BUILD_ALWAYS 0