#
# This is CMakeLists for project: Error
#
project(Error)

enable_all_warnings()
enable_warnings_as_errors()

include_cmake(${SRC})

# Adds a library target called <name> to be built from the source files listed in the command invocation.
# The <name> corresponds to the logical target name and must be globally unique within a project.
# The actual file name of the library built is constructed based on conventions of the native platform (such as lib<name>.a or <name>.lib).
add_library(Error SHARED ${SOURCES} )

target_include_directories(Error
	SYSTEM PRIVATE
	    "${Boost_INCLUDE_DIRS}"
)

target_include_directories(Error
    PRIVATE
        "${OPENIPC_ROOT}/Source/Public_Include"
    )

set_target_properties(Error PROPERTIES
                      OUTPUT_NAME Error_${ARCHITECTURE_NAME}
                      DEFINE_SYMBOL ERROR_EXPORTS
                      FOLDER "/Foundation")

# Link a target to given libraries.
target_link_libraries(Error PRIVATE CommonUtils
                                    Logging
                                    ${Boost_THREAD_LIBRARY}
                                    ${Boost_SYSTEM_LIBRARY}
                                    Threads::Threads)

if(UNIX AND NOT APPLE)
    target_link_libraries(Error PRIVATE rt)
endif()

install(TARGETS Error
        LIBRARY DESTINATION ${DPL_BIN_ROOT} COMPONENT openipc
        RUNTIME DESTINATION ${DPL_BIN_ROOT} COMPONENT openipc)

INSTALL_PDB(Error)

if(CONFIG_SHIP_PLUGINSDK)
    install(TARGETS Error
            ARCHIVE DESTINATION "${DPL_PROBEPLUGINSDK_LIBS}" COMPONENT probepluginsdk
            LIBRARY DESTINATION "${DPL_PROBEPLUGINSDK_LIBS}" COMPONENT probepluginsdk
            RUNTIME DESTINATION "${DPL_PROBEPLUGINSDK_LIBS}" COMPONENT probepluginsdk)

    INSTALL_PDB(Error)
endif()
