Back out systemd linking to top-level CMakeLists

systemd notifies on startup really belong in daemon, not core, so this
paves the way for easily moving the calls there.
This commit is contained in:
Jason Rhinelander 2020-04-27 20:17:24 -03:00
parent 89f6928197
commit d3a8baf9e7
2 changed files with 15 additions and 10 deletions

View File

@ -422,6 +422,7 @@ ExternalProject_Add(generate_translations_header
add_library(libunbound INTERFACE)
add_library(miniupnpc INTERFACE)
add_library(systemd INTERFACE) # Will do nothing unless we find and enable systemd support
# Allow -D DOWNLOAD_SODIUM=FORCE to download without even checking for a local libsodium
option(DOWNLOAD_SODIUM "Allow libsodium to be downloaded and built locally if not found on the system" OFF)
@ -445,6 +446,19 @@ endif()
export(TARGETS sodium NAMESPACE sodium:: FILE sodium-exports.cmake)
install(TARGETS sodium EXPORT sodiumConfig DESTINATION ${CMAKE_INSTALL_LIBDIR})
option(WITH_SYSTEMD "Attempts to link against and enable systemd daemon notification support" ON)
if (WITH_SYSTEMD)
pkg_check_modules(SYSTEMD libsystemd IMPORTED_TARGET)
if(SYSTEMD_FOUND)
target_compile_definitions(systemd INTERFACE ENABLE_SYSTEMD)
target_link_libraries(systemd INTERFACE PkgConfig::SYSTEMD)
else()
message(WARNING "systemd not found; building without systemd support (use -DWITH_SYSTEMD=OFF to suppress this warning)")
endif()
endif()
add_subdirectory(external)
target_compile_definitions(easylogging PRIVATE AUTO_INITIALIZE_EASYLOGGINGPP)

View File

@ -55,18 +55,9 @@ target_link_libraries(cryptonote_core
PRIVATE
Boost::program_options
Boost::chrono
systemd
extra)
option(WITH_SYSTEMD "Attempts to link against and enable systemd daemon notification support" ON)
if (WITH_SYSTEMD)
pkg_check_modules(SYSTEMD libsystemd)
if(SYSTEMD_FOUND)
target_compile_definitions(cryptonote_core PRIVATE ENABLE_SYSTEMD)
target_link_libraries(cryptonote_core PRIVATE ${SYSTEMD_LIBRARIES})
endif()
endif()
if(PER_BLOCK_CHECKPOINT)
target_compile_definitions(cryptonote_core PUBLIC PER_BLOCK_CHECKPOINT)
target_link_libraries(cryptonote_core PUBLIC blocks)