# libmiracle-net — the transport.
#
# The only place in the project that owns a socket. Everything it knows about
# the protocol it borrows from libmiracle; nothing here should need a test
# that a test in libmiracle could not express more cheaply.

find_package(Qt6 REQUIRED COMPONENTS Core Network)

# The header is listed as a source on purpose: it carries Q_OBJECT, and
# AUTOMOC only finds headers that are either listed here or sit beside a
# source of the same base name. Ours lives under include/, so it must be
# named explicitly or moc never runs and the vtable goes missing at link time.
qt_add_library(miracle-net STATIC
    src/connection.cpp
    include/miracle/net/connection.h)

add_library(Miracle::net ALIAS miracle-net)

target_include_directories(miracle-net PUBLIC include)
target_link_libraries(miracle-net
    PUBLIC miracle Qt6::Core Qt6::Network
    PRIVATE miracle_qt_warnings)

set_target_properties(miracle-net PROPERTIES AUTOMOC ON)
