idf_component_register(SRCS
    user_main.c
    settings.c
    shutdown_handlers.c
    sntp_cli.c
    utils.c
    wifi_conn.c
    mbiface.c
    onewires.c
    actuators.c
    fancontrol.c
    console/console_ioimpl.c
    console/console_server.c
    console/register_cmds.c
    console/telnet_parser.c
    console/commands/cmd_dump.c
    console/commands/cmd_factory_reset.c
    console/commands/cmd_heap.c
    console/commands/cmd_ip.c
    console/commands/cmd_restart.c
    console/commands/cmd_tasks.c
    console/commands/cmd_version.c
    console/commands/cmd_wifi.c
    console/commands/cmd_pw.c
    INCLUDE_DIRS ".")

find_package(Git REQUIRED)

execute_process(
    COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE _commit_hash
)
# TODO what's this?
execute_process(
    COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE _revision_number
)
string(REGEX REPLACE "\n" "" _commit_hash "${_commit_hash}")
string(REGEX REPLACE "\n" "" _revision_number "${_revision_number}")
string(TIMESTAMP _build_time_stamp)

configure_file(
    "gitversion.h.in"
    "${CMAKE_CURRENT_BINARY_DIR}/config/gitversion.h"
)

include_directories("${CMAKE_CURRENT_BINARY_DIR}/config")