Skip to content
Snippets Groups Projects
Commit 061ead60 authored by Amna Snene's avatar Amna Snene
Browse files

build: fix dnc.service build condition

build dnc.service only if DNC_SYSTEMD AND BUILD_TOOLS are both enabled

Change-Id: Ie9c8ae855c801d5bf5856cb09a41342d3f71d077
parent f38fa106
No related branches found
No related tags found
No related merge requests found
......@@ -24,9 +24,8 @@ option(DHTNET_TESTABLE "Enable API for tests" ON)
option(BUILD_TOOLS "Build tools" ON)
option(BUILD_BENCHMARKS "Build benchamrks" ON)
option(BUILD_DEPENDENCIES "Build dependencies" ON)
option(DNC_SYSTEMD "Enable dnc systemd integration" ON)
option (DNC_SYSTEMD_UNIT_FILE_LOCATION "Where to install systemd unit file")
option(DNC_SYSTEMD "Enable dnc systemd integration" ON)
if (NOT MSVC)
set(DEPENDENCIES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/install/${TARGET})
......@@ -111,28 +110,28 @@ else()
-D_UNICODE")
endif()
if (DNC_SYSTEMD)
if (DNC_SYSTEMD AND BUILD_TOOLS AND NOT MSVC)
if (NOT DEFINED DNC_SYSTEMD_UNIT_FILE_LOCATION OR NOT DNC_SYSTEMD_UNIT_FILE_LOCATION)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} systemd --variable=systemdsystemunitdir
OUTPUT_VARIABLE SYSTEMD_UNIT_INSTALL_DIR)
message("-- Using Systemd unit installation directory by pkg-config: " ${SYSTEMD_UNIT_INSTALL_DIR})
else()
message("-- Using Systemd unit installation directory requested: " ${DNC_SYSTEMD_UNIT_FILE_LOCATION})
set(SYSTEMD_UNIT_INSTALL_DIR ${DNC_SYSTEMD_UNIT_FILE_LOCATION})
endif()
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} systemd --variable=systemdsystemunitdir
OUTPUT_VARIABLE SYSTEMD_UNIT_INSTALL_DIR)
message("-- Using Systemd unit installation directory by pkg-config: " ${SYSTEMD_UNIT_INSTALL_DIR})
else()
message("-- Using Systemd unit installation directory requested: " ${DNC_SYSTEMD_UNIT_FILE_LOCATION})
set(SYSTEMD_UNIT_INSTALL_DIR ${DNC_SYSTEMD_UNIT_FILE_LOCATION})
endif()
configure_file (
tools/dnc/systemd/dnc.service.in
systemd/dnc.service
@ONLY
)
if (SYSTEMD_UNIT_INSTALL_DIR)
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_UNIT_INSTALL_DIR "${SYSTEMD_UNIT_INSTALL_DIR}")
set (systemdunitdir "${SYSTEMD_UNIT_INSTALL_DIR}")
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/systemd/dnc.service DESTINATION ${systemdunitdir})
install (FILES tools/dnc/dnc.yaml DESTINATION ${sysconfdir}/dhtnet/)
else()
message(WARNING "Systemd unit installation directory not found. The systemd unit won't be installed.")
configure_file (
tools/dnc/systemd/dnc.service.in
systemd/dnc.service
@ONLY
)
if (SYSTEMD_UNIT_INSTALL_DIR)
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_UNIT_INSTALL_DIR "${SYSTEMD_UNIT_INSTALL_DIR}")
set (systemdunitdir "${SYSTEMD_UNIT_INSTALL_DIR}")
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/systemd/dnc.service DESTINATION ${systemdunitdir})
install (FILES tools/dnc/dnc.yaml DESTINATION ${sysconfdir}/dhtnet/)
else()
message(WARNING "Systemd unit installation directory not found. The systemd unit won't be installed.")
endif()
endif()
# Sources
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment