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 or file.
git_describe(<file|dir> OUTPUT)
This function runs
git describe --abbrev=12 --alwayson the provided directory, or if provided a file, the directory containing that file. In both cases, the result is stored in the provided output variable.file|dirThe directory or file to run the git command for.
OUTPUTThe variable name where the git description will be stored. If the git command fails or Git is not found, 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()