sdkconfig.defaults for different versions of IDF

User avatar
7amaaan
Posts: 1
Joined: Fri Jan 14, 2022 3:35 pm

sdkconfig.defaults for different versions of IDF

Postby 7amaaan » Fri Jun 16, 2023 10:22 am

Hi.

I know build system supports multiple 'sdkconfig.defaults' files. Each target can have its sdkconfig.defaults file.
But is there a proper way to manage`sdkconfig.defaults` for different versions of ESP-IDF?
I came up with something like this:

Code: Select all

cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(SDKCONFIG "${CMAKE_BINARY_DIR}/sdkconfig")
set(SDKCONFIG_DEFAULTS "sdkconfig.defaults")
if(IDF_VERSION_MAJOR EQUAL 5)
    list(APPEND SDKCONFIG_DEFAULTS "sdkconfig.defaults.v5")
elseif(IDF_VERSION_MAJOR EQUAL 4)
    list(APPEND SDKCONFIG_DEFAULTS "sdkconfig.defaults.v4")
endif()
project(Playground)
It is somehow working but build system documentation says all set commands must be after 'cmake_minimum_required' and before 'include()'.

Can I use this? or it is a bug and it would fix later?

Who is online

Users browsing this forum: No registered users and 87 guests