git
Provides Git-related functionality for the Zephyr build system.
This module provides functions for interacting with Git repositories within the Zephyr build system.
Commands
- git_describe
Get a short Git description associated with a directory.
git_describe(DIR OUTPUT)
This function runs
git describe --abbrev=12 --alwaysin the specified directory and stores the result in the provided output variable.DIRThe directory to run the git command in.
OUTPUTThe variable name where the git description will be stored. If the git command fails, this variable will not be set.
The function will output status messages if:
The git command fails (error message)
The git command produces warnings (warning message)
Example Usage
include(git)
git_describe(${CMAKE_CURRENT_SOURCE_DIR} GIT_DESCRIPTION)
if(DEFINED GIT_DESCRIPTION)
message(STATUS "Git description: ${GIT_DESCRIPTION}")
endif()