From cedf304e6d5458365b624489dc40fffa87f04d80 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 8 Jun 2024 11:08:33 -0400 Subject: [PATCH] Add URL to repo & fix some spelling/grammar --- CMakeLists.txt | 24 ++++++++++++------------ README.md | 40 ++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a29a651..050098f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,20 @@ # ---------------------------------------------------------------------------- # # # Copyright (c) 2020 C++ Modern Framework +# https://github.com/cppmf/GitInfo.cmake # # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # -# Following variables will be set when calling GitInfo +# The following variables will be set when calling GitInfo # # GIT_DIR: path to the project .git directory # GIT_IS_DIRTY: whether or not the working tree is dirty -# GIT_HEAD_BRANCH : name of the branch associated te HEAD +# GIT_HEAD_BRANCH : name of the branch associated with HEAD # GIT_REVISION_HASH: current HEAD sha hash -# GIT_REVISION: shorten version of GIT_REVISION_HASH -# GIT_REVISION_NAME: name associated to GIT_REVISION_HASH +# GIT_REVISION: short version of GIT_REVISION_HASH +# GIT_REVISION_NAME: name associated with GIT_REVISION_HASH # GIT_AUTHOR_NAME : author name # GIT_AUTHOR_EMAIL : author email # GIT_AUTHOR_DATE : author date @@ -32,7 +33,7 @@ # source should point to the root project directory function(GitInfo source) - # Check is source is a valid path + # Check if source is a valid path if(NOT EXISTS ${source}) message(FATAL_ERROR "'${source}' is not a valid path") endif() @@ -43,7 +44,6 @@ function(GitInfo source) # Check if .git folder exist if(EXISTS ${GIT_DIR}) - # set(GIT_DIR "${GIT_DIR}" CACHE PATH "Project .git directory") # Check if git is installed @@ -70,11 +70,11 @@ function(GitInfo source) set(GIT_IS_DIRTY OFF CACHE BOOL "Indicate if current branch is dirty") endif() - # name of the brack associated te HEAD + # name of the branch associated with HEAD execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${source} OUTPUT_VARIABLE GIT_HEAD_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE) - set(GIT_HEAD_BRANCH "${GIT_HEAD_BRANCH}" CACHE INTERNAL "name of the brack associated te HEAD") + set(GIT_HEAD_BRANCH "${GIT_HEAD_BRANCH}" CACHE INTERNAL "name of the branch associated with HEAD") # git revision full hash execute_process(COMMAND ${GIT_EXECUTABLE} show -s "--format=%H" HEAD @@ -82,17 +82,17 @@ function(GitInfo source) OUTPUT_VARIABLE GIT_REVISION_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) set(GIT_REVISION_HASH "${GIT_REVISION_HASH}" CACHE INTERNAL "git revision full hash") - # shorten version of git revision + # short version of git revision execute_process(COMMAND ${GIT_EXECUTABLE} show -s "--format=%h" HEAD WORKING_DIRECTORY ${source} OUTPUT_VARIABLE GIT_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE) - set(GIT_REVISION "${GIT_REVISION}" CACHE INTERNAL "shorten version of git revision") + set(GIT_REVISION "${GIT_REVISION}" CACHE INTERNAL "short version of git revision") - # shorten version of git revision name + # short version of git revision name execute_process(COMMAND ${GIT_EXECUTABLE} show -s "--format=%s" HEAD WORKING_DIRECTORY ${source} OUTPUT_VARIABLE GIT_REVISION_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) - set(GIT_REVISION_NAME "${GIT_REVISION_NAME}" CACHE INTERNAL "shorten version of git revision name") + set(GIT_REVISION_NAME "${GIT_REVISION_NAME}" CACHE INTERNAL "short version of git revision name") # author name execute_process(COMMAND ${GIT_EXECUTABLE} show -s "--format=%an" HEAD diff --git a/README.md b/README.md index 095675f..997eb6f 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ --- ## Usage + The easiest way to use [GitInfo.cmake](https://github.com/cppmf/GitInfo.cmake) is by adding [GetCPM.cmake](https://github.com/cppmf/GetCPM.cmake) to your project. First add GetCPM.cmake module : @@ -20,7 +21,6 @@ wget -O cmake/GetCPM.cmake https://raw.githubusercontent.com/cppmf/GetCPM.cmake/ Then add the following lines to the project's `CMakeLists.txt`. - ```bash # include CPM.cmake module include(cmake/GetCPM.cmake) @@ -40,22 +40,22 @@ GitInfo(${CMAKE_CURRENT_SOURCE_DIR}) After calling GitInfo function, the following variables will be set -variable | description ----------|------------ -GIT_DIR | path to the project .git directory -GIT_IS_DIRTY | whether or not the working tree is dirty -GIT_HEAD_BRANCH | name of the branch associated to HEAD -GIT_REVISION_HASH | current HEAD sha hash -GIT_REVISION | shorten version of GIT_REVISION_HASH -GIT_REVISION_NAME | name associated to GIT_REVISION_HASH -GIT_AUTHOR_NAME | author name -GIT_AUTHOR_EMAIL | author email -GIT_AUTHOR_DATE | author date -GIT_AUTHOR_DATE_ISO | author date, strict ISO 8601 format -GIT_COMMITTER_NAME | committer name -GIT_COMMITTER_EMAIL | committer email -GIT_COMMITTER_DATE | committer date -GIT_COMMITTER_DATE_ISO | committer date, strict ISO 8601 format -GIT_REMOTE_ORIGIN_URL | origin remote url -GIT_LATEST_TAG_LONG | most recent tag of the current branch -GIT_LATEST_TAG | most recent tagname of the current branch +| variable | description | +| ---------------------- | ----------------------------------------- | +| GIT_DIR | path to the project .git directory | +| GIT_IS_DIRTY | whether or not the working tree is dirty | +| GIT_HEAD_BRANCH | name of the branch associated with HEAD | +| GIT_REVISION_HASH | current HEAD sha hash | +| GIT_REVISION | short version of GIT_REVISION_HASH | +| GIT_REVISION_NAME | name associated to GIT_REVISION_HASH | +| GIT_AUTHOR_NAME | author name | +| GIT_AUTHOR_EMAIL | author email | +| GIT_AUTHOR_DATE | author date | +| GIT_AUTHOR_DATE_ISO | author date, strict ISO 8601 format | +| GIT_COMMITTER_NAME | committer name | +| GIT_COMMITTER_EMAIL | committer email | +| GIT_COMMITTER_DATE | committer date | +| GIT_COMMITTER_DATE_ISO | committer date, strict ISO 8601 format | +| GIT_REMOTE_ORIGIN_URL | origin remote url | +| GIT_LATEST_TAG_LONG | most recent tag of the current branch | +| GIT_LATEST_TAG | most recent tagname of the current branch |