# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)

# esp_app_desc.version 与 menuconfig CONFIG_MY_APP_VERSION 保持一致
set(_proj_ver "1.0.1")
foreach(_cfg IN ITEMS sdkconfig.defaults sdkconfig)
    set(_cfg_path "${CMAKE_CURRENT_SOURCE_DIR}/${_cfg}")
    if(EXISTS "${_cfg_path}")
        file(STRINGS "${_cfg_path}" _ver_line REGEX "^CONFIG_MY_APP_VERSION=")
        if(_ver_line)
            string(REGEX REPLACE "^CONFIG_MY_APP_VERSION=\"(.*)\"$" "\\1" _proj_ver "${_ver_line}")
        endif()
    endif()
endforeach()
set(PROJECT_VER "${_proj_ver}")

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(ESPRCCar)

# Release 模式：强制全局静默，编译期删除所有 ESP_LOG (I/W/E)
# menuconfig 选择 Release 时自动生效，无需其他操作
if(CONFIG_ROBO_APP_FW_RELEASE)
    idf_build_set_property(COMPILE_DEFINITIONS "LOG_LOCAL_LEVEL=ESP_LOG_NONE" APPEND)
endif()
