feat(cmakev2/idf): initialize build system version variables

Set the global variables IDF_BUILD_V2 and IDF_BUILD_VER, along with the
build properties and environmental variables. These are intended to be
used by components to determine which build system version they are
evaluated under and to make adjustments based on this information.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-08-12 15:59:03 +02:00
committed by BOT
parent 70f5366408
commit 2967ff3e2e

View File

@@ -23,6 +23,21 @@ include(kconfig)
include(project)
include(GetGitRevisionDescription)
#[[
__init_build_version()
Set the global variables IDF_BUILD_V2 and IDF_BUILD_VER, as well as the
build properties and environmental variables.
#]]
function(__init_build_version)
set(IDF_BUILD_V2 y PARENT_SCOPE)
set(IDF_BUILD_VER 2 PARENT_SCOPE)
idf_build_set_property(IDF_BUILD_V2 y)
idf_build_set_property(IDF_BUILD_VER 2)
set(ENV{IDF_BUILD_V2} y)
set(ENV{IDF_BUILD_VER} 2)
endfunction()
#[[
__init_idf_path()
@@ -484,6 +499,9 @@ idf_build_set_property(BUILD_DIR "${CMAKE_BINARY_DIR}")
# Enable the generation of compile_commands.json.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Initialize build system version.
__init_build_version()
# Initialize IDF_PATH and set it as a global and environmental variable, as
# well as a build property.
__init_idf_path()