From 0d26a2bf506f378527d61a525bd565ee213b6285 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 19 Apr 2018 08:49:47 +0200 Subject: [PATCH] Fix SysconfigFile detection for binary builds It may happen that the variable is not properly initialized and we'll have an empty string. Observed on macOS and inside Docker. refs #6215 refs #6241 --- CMakeLists.txt | 5 +++++ etc/initsystem/CMakeLists.txt | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 761feb5c0..3a76b123e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,11 @@ set(ICINGA2_GIT_VERSION_INFO ON CACHE BOOL "Whether to use git describe") set(ICINGA2_UNITY_BUILD ON CACHE BOOL "Whether to perform a unity build") set(ICINGA2_LTO_BUILD OFF CACHE BOOL "Whether to use LTO") +if(NOT WIN32) + set(ICINGA2_SYSCONFIGFILE "${CMAKE_INSTALL_FULL_SYSCONFDIR}/sysconfig/icinga2" CACHE PATH "where to store configuation for the init system, defaults to /etc/sysconfig/icinga2") + +endif() + site_name(ICINGA2_BUILD_HOST_NAME) set(ICINGA2_BUILD_COMPILER_NAME "${CMAKE_CXX_COMPILER_ID}") diff --git a/etc/initsystem/CMakeLists.txt b/etc/initsystem/CMakeLists.txt index 1bbd4262a..a236a39d7 100644 --- a/etc/initsystem/CMakeLists.txt +++ b/etc/initsystem/CMakeLists.txt @@ -16,8 +16,6 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. if(NOT WIN32) - set(ICINGA2_SYSCONFIGFILE "${CMAKE_INSTALL_FULL_SYSCONFDIR}/sysconfig/icinga2" CACHE PATH "where to store configuation for the init system, defaults to /etc/sysconfig/icinga2") - configure_file(icinga2.sysconfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.sysconfig @ONLY) get_filename_component(ICINGA2_SYSCONFIGFILE_NAME ${ICINGA2_SYSCONFIGFILE} NAME) get_filename_component(ICINGA2_SYSCONFIGFILE_DIR ${ICINGA2_SYSCONFIGFILE} PATH) -- 2.40.0