From 2967ff3e2ead18ad971d17db20c641e167ac7887 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Tue, 12 Aug 2025 15:59:03 +0200 Subject: [PATCH] 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 --- tools/cmakev2/idf.cmake | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/cmakev2/idf.cmake b/tools/cmakev2/idf.cmake index 0378e5e95ea..28cc309cfc0 100644 --- a/tools/cmakev2/idf.cmake +++ b/tools/cmakev2/idf.cmake @@ -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()