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

set(SOURCES DbClass.cpp
            DbServer.cpp
            DbDatum.cpp
            Database.cpp
            DbDevice.cpp
            DbHistory.cpp
            DbAttribute.cpp
            DbServerCache.cpp
            DbServerData.cpp
            DelayEvent.cpp
            DelayedEventSubThread.cpp
            DelayedEventUnsubThread.cpp
            DeviceAttribute.cpp
            Connection.cpp
            DeviceProxy.cpp
            DeviceData.cpp
            DeviceAttributeHistory.cpp
            DeviceDataHistory.cpp
            AttributeAlarmInfo.cpp
            AttributeEventInfo.cpp
            AttributeInfo.cpp
            AttributeInfoEx.cpp
            CommandInfo.cpp
            DevCommandInfo.cpp
            DeviceAttributeConfig.cpp
            DevicePipe.cpp
            DevicePipeBlob.cpp
            ApiUtil.cpp
            AsynchRequest.cpp
            AsynReq.cpp
            CallBackThread.cpp
            Connection_asyn.cpp
            DeviceProxy_asyn.cpp
            Connection_asyn_cb.cpp
            DeviceProxy_asyn_cb.cpp
            AttributeProxy.cpp
            FwdAttrConfEventData.cpp
            FwdEventData.cpp
            Group.cpp
            GroupAttrReply.cpp
            GroupAttrReplyList.cpp
            GroupCmdReply.cpp
            GroupDeviceElement.cpp
            GroupElement.cpp
            GroupElementFactory.cpp
            GroupReply.cpp
            GroupReplyList.cpp
            GroupCmdReplyList.cpp
            FileDatabase.cpp
            NamedDevFailed.cpp
            AccessProxy.cpp
            LockThread.cpp
            EventData.cpp
            AttrConfEventData.cpp
            DataReadyEventData.cpp
            DevIntrChangeEventData.cpp
            PipeEventData.cpp
            EventConsumer.cpp
            EventKeepAliveThread.cpp
            EventQueue.cpp
            NotifdEventConsumer.cpp
            ZmqEventConsumer.cpp)

add_library(client_objects OBJECT ${SOURCES})
add_dependencies(client_objects idl_objects common_objects)
set_cflags_and_include(client_objects)

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
  set_source_files_properties(
        DeviceAttribute.cpp
        PROPERTIES
        COMPILE_FLAGS -Wno-stringop-overflow)
endif()

if(WIN32)
    target_compile_definitions(client_objects PRIVATE "${windows_defs}")
else()
    target_compile_options(client_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(client_objects PRIVATE _TANGO_LIB)
    endif()
endif()

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