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 <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-11-04 07:48:12 +01:00
parent 234964890a
commit 94411ff55b
+21
View File
@@ -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()