cmake_minimum_required(VERSION 3.17)
set(AVR_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}/avr-project.cmake)
if (EXISTS ${AVR_PROJECT})
    INCLUDE(${AVR_PROJECT})
else (EXISTS ${AVR_PROJECT})
    set("AVR_PROJECT_NAME" "Unconfigured project")
endif (EXISTS ${AVR_PROJECT})
project(${AVR_PROJECT_NAME})
#check avr build tools installed
if (DEFINED ENV{AVR_BUILD_TOOLS})
    set(BUILD_TOOLS_ROOT "$ENV{AVR_BUILD_TOOLS}")
else (DEFINED ENV{AVR_BUILD_TOOLS})
    message(FATAL_ERROR "Build tools is not installed or ENV{AVR_BUILD_TOOLS} is not defined")
endif (DEFINED ENV{AVR_BUILD_TOOLS})

INCLUDE("${BUILD_TOOLS_ROOT}/scripts/commons.cmake")
