Define SD_JOURNAL_SUPPRESS_LOCATION more locally

add_definitions would set SD_JOURNAL_SUPPRESS_LOCATION for all targets
in directory and sub-directories. However, another future target might
want the opposite, so define it as local as possible to journaldlogger.cpp.

To make this work, we must take journaldlogger.cpp out of the unity
build, because all files from a unity of share compiler definitions.
This commit is contained in:
Tobias Deiminger 2021-09-14 21:49:55 +02:00 committed by haxtibal
parent 272191840f
commit eb8f67335e
1 changed files with 9 additions and 2 deletions

View File

@ -114,7 +114,10 @@ if(WIN32)
install(TARGETS eventprovider LIBRARY DESTINATION ${CMAKE_INSTALL_SBINDIR}) install(TARGETS eventprovider LIBRARY DESTINATION ${CMAKE_INSTALL_SBINDIR})
endif() endif()
set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/application-version.cpp PROPERTY EXCLUDE_UNITY_BUILD TRUE) set_property(
SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/application-version.cpp ${CMAKE_CURRENT_SOURCE_DIR}/journaldlogger.cpp
PROPERTY EXCLUDE_UNITY_BUILD TRUE
)
if(ICINGA2_UNITY_BUILD) if(ICINGA2_UNITY_BUILD)
mkunity_target(base base base_SOURCES) mkunity_target(base base base_SOURCES)
@ -125,7 +128,11 @@ if(HAVE_SYSTEMD)
NAMES systemd/sd-daemon.h NAMES systemd/sd-daemon.h
HINTS ${SYSTEMD_ROOT_DIR}) HINTS ${SYSTEMD_ROOT_DIR})
include_directories(${SYSTEMD_INCLUDE_DIR}) include_directories(${SYSTEMD_INCLUDE_DIR})
add_definitions(-DSD_JOURNAL_SUPPRESS_LOCATION) set_property(
SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/journaldlogger.cpp
APPEND PROPERTY COMPILE_DEFINITIONS
SD_JOURNAL_SUPPRESS_LOCATION
)
endif() endif()
add_library(base OBJECT ${base_SOURCES}) add_library(base OBJECT ${base_SOURCES})