# XCB/Xorg Window Attaching SenseAPI backend
cmake_dependent_option(ENABLE_SENSEAPI_xcbWindow
    "Enable XCB/Xorg Window Attaching SenseAPI backend" ON
    "ENABLE_LIB_xcbXorg" OFF)

if(ENABLE_SENSEAPI_xcbWindow)
    add_library(xcbWindow SHARED
        xcbWindow.cpp
    )

    target_include_directories(xcbWindow PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}
        ${CMAKE_CURRENT_SOURCE_DIR}/../../include
        ${CMAKE_CURRENT_SOURCE_DIR}/../../smocore/include
        ${CMAKE_CURRENT_SOURCE_DIR}/../../commonLibs
    )

    # Link against XCB library directly (libxcbXorg will be loaded dynamically)
    pkg_check_modules(XCB REQUIRED xcb)
    target_link_libraries(xcbWindow ${XCB_LIBRARIES})

    # Set config define for header generation
    add_compile_definitions(CONFIG_SENSEAPI_XCBWINDOW_ENABLED)

    # Install rules
    install(TARGETS xcbWindow DESTINATION lib)
endif()
