# SPDX-FileCopyrightText: 2016 Copyright contributors to the cppTango project
#
# SPDX-License-Identifier: LGPL-3.0-or-later

set(SOURCES
    Appender.cpp
    AppenderAttachable.cpp
    LayoutAppender.cpp
    FileAppender.cpp
    RollingFileAppender.cpp
    OstreamAppender.cpp
    Layout.cpp
    PatternLayout.cpp
    XmlLayout.cpp
    Logger.cpp
    LoggerStream.cpp
    LoggingEvent.cpp
    Level.cpp
    Filter.cpp
    StringUtil.cpp
   )

add_library(log4tango_objects OBJECT ${SOURCES})
add_dependencies(log4tango_objects idl_objects)
set_cflags_and_include(log4tango_objects)

if(WIN32)
    target_compile_definitions(log4tango_objects PRIVATE "${windows_defs}")
else()
    target_compile_options(log4tango_objects PRIVATE -fPIC)
    if(CMAKE_BUILD_TYPE STREQUAL "Debug")
        # Do not define _TANGO_LIB when compiling Tango debug library on Linux
        # in order to keep the same behaviour as in the past:
        # cout messages are not redirected to the logging system but are
        # instead displayed directly on the console
    else()
        target_compile_definitions(log4tango_objects PRIVATE _TANGO_LIB)
    endif()
endif()

if(NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
  target_precompile_headers(log4tango_objects REUSE_FROM common_objects)
endif()
