C

Event Sender: Sending Messages to Applications

cmake_minimum_required(VERSION 3.16)
project(eventsender LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOMOC ON)

# Define the condition for HOST_BUILD
set(HOST_BUILD OFF)  # Default to OFF

if (NOT CMAKE_CROSSCOMPILING AND (NOT UNIX OR NOT (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm|aarch64")))
    set(HOST_BUILD ON)
endif()

if(NOT DEFINED INSTALL_EXAMPLESDIR)
  set(INSTALL_EXAMPLESDIR "examples")
endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")

find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick SafeEventSender)

set(sources
    main.cpp
    tcpdatacontrol.cpp
    tcpdatacontrol.h
    datacontrolinterface.h
)

set(resource_files
    "qml.qrc"
)
qt6_add_resources(sources ${resource_files})

add_executable(eventsender WIN32 MACOSX_BUNDLE
    ${sources}

)

target_compile_definitions(eventsender PUBLIC
    HOST_BUILD
)

target_link_libraries(eventsender PUBLIC
    Qt::Quick
    Qt::Qml
    Qt::Gui
)

target_link_libraries(eventsender PUBLIC
    Qt::SafeEventSender
)

install(TARGETS eventsender
    RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
    BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
    LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)