From 94411ff55bfce50043962462ea122a712abbc571 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Thu, 31 Jul 2025 14:51:29 +0200 Subject: [PATCH] feat(cmakev2/idf): add __git_init to identify the git executable The Git tool will be used in various parts of the build system, such as retrieving the IDF version using git-describe or checking submodules. Similar to the Python interpreter, add an initialization function to identify the Git executable. Signed-off-by: Frantisek Hrbata --- tools/cmakev2/idf.cmake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/cmakev2/idf.cmake b/tools/cmakev2/idf.cmake index 520c6476def..fa67a6931bd 100644 --- a/tools/cmakev2/idf.cmake +++ b/tools/cmakev2/idf.cmake @@ -49,6 +49,24 @@ function(__init_idf_path) set(ENV{IDF_PATH} ${idf_path}) endfunction() +#[[ + __init_git() + + Determine the executable. + + Set the GIT build property. +#]] +function(__init_git) + find_package(Git) + if(NOT GIT_FOUND) + idf_build_set_property(GIT NOTFOUND) + idf_warn("Git executable not found.") + return() + endif() + + idf_build_set_property(GIT "${GIT_EXECUTABLE}") +endfunction() + #[[ __init_python() @@ -332,6 +350,9 @@ idf_build_set_property(BUILD_DIR "${CMAKE_BINARY_DIR}") # well as a build property. __init_idf_path() +# Determine git executable and set GIT build property. +__init_git() + # Determine the Python interpreter and check package dependencies if necessary. __init_python()