if (ELSEN_ARCH STREQUAL "xtensa")

    target_sources(
        ${LIBRARY_NAME} PRIVATE
        ${CMAKE_CURRENT_LIST_DIR}/arduino/spi.cc
        ${CMAKE_CURRENT_LIST_DIR}/arduino/utilities.cc
        ${CMAKE_CURRENT_LIST_DIR}/devices/spi.cc
        ${CMAKE_CURRENT_LIST_DIR}/logger.cc
        ${CMAKE_CURRENT_LIST_DIR}/mqtt_client.cc
        ${CMAKE_CURRENT_LIST_DIR}/signal.cc
        ${CMAKE_CURRENT_LIST_DIR}/utilities.cc
        ${CMAKE_CURRENT_LIST_DIR}/wifi.cc
    )

    target_compile_options (${LIBRARY_NAME} PRIVATE "${IDF_COMPILE_OPTIONS}")
    target_compile_options (${LIBRARY_NAME} PRIVATE "${IDF_CXX_COMPILE_OPTIONS}")

    # All of these are to work around warnings generated by the IDF SDK
    # Since we are aggressive with our warning level and treat all warnings
    # as errors, any file included from the IDF SDK causes a compilation failure.

    # So we just set the proper include directories from every direct dependency
    # with the SYSTEM flag set.
    get_target_property (ESP_EVENT_INCLUDES idf::esp_event INCLUDE_DIRECTORIES)
    list (POP_FRONT ESP_EVENT_INCLUDES)

    get_target_property(ESP_WIFI_INCLUDES idf::esp_wifi INCLUDE_DIRECTORIES)
    list (POP_FRONT ESP_WIFI_INCLUDES)

    get_target_property(ESP_LOG_INCLUDES idf::log INCLUDE_DIRECTORIES)
    list (POP_FRONT ESP_LOG_INCLUDES)

    get_target_property(ESP_MQTT_INCLUDES idf::mqtt INCLUDE_DIRECTORIES)
    list (POP_FRONT ESP_MQTT_INCLUDES)

    get_target_property(ESP_FREE_RTOS_INCLUDES idf::freertos INCLUDE_DIRECTORIES)
    list (POP_FRONT ESP_FREE_RTOS_INCLUDES)

    get_target_property(ESP_SOC_INCLUDES idf::soc INCLUDE_DIRECTORIES)
    list (POP_FRONT ESP_SOC_INCLUDES)

    target_include_directories (
        ${LIBRARY_NAME} SYSTEM PUBLIC
        ${ESP_EVENT_INCLUDES}
        ${ESP_WIFI_INCLUDES}
        ${ESP_LOG_INCLUDES}
        ${ESP_MQTT_INCLUDES}
        ${ESP_FREE_RTOS_INCLUDES}
        ${ESP_SOC_INCLUDES}
    )

    target_link_libraries (
        ${LIBRARY_NAME} PUBLIC
        idf::esp_event
        idf::esp_wifi
        idf::log
        idf::mqtt
        idf::freertos
        idf::soc
    )

endif ()
