# The following 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)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
idf_build_set_property(MINIMAL_BUILD ON)
file(STRINGS "version.txt" PROJECT_VER)

# Provisioning builds get a "-prov" version suffix so the production firmware
# can detect and purge them from the passive OTA partition after an OTA swap.
# Must be set before project() — that call bakes PROJECT_VER into the compiled binary.
if(EXISTS "${CMAKE_BINARY_DIR}/sdkconfig")
    file(STRINGS "${CMAKE_BINARY_DIR}/sdkconfig" _sdkconfig_lines)
    if("CONFIG_PROVISION=y" IN_LIST _sdkconfig_lines)
        set(PROJECT_VER "${PROJECT_VER}-prov")
    endif()
endif()

project(cackalackybadgy2026)