The complete source code of IdealIRC
http://www.idealirc.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
590 B
24 lines
590 B
4 years ago
|
# From http://xit0.org/2013/04/cmake-use-git-branch-and-commit-details-in-project/
|
||
|
|
||
|
#
|
||
|
# Produces two self-explanatory variables;
|
||
|
# GIT_BRANCH
|
||
|
# GIT_COMMIT_HASH
|
||
|
#
|
||
|
|
||
|
# Get the current working branch
|
||
|
execute_process(
|
||
|
COMMAND git rev-parse --abbrev-ref HEAD
|
||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||
|
OUTPUT_VARIABLE GIT_BRANCH
|
||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||
|
)
|
||
|
|
||
|
# Get the latest abbreviated commit hash of the working branch
|
||
|
execute_process(
|
||
|
COMMAND git log -1 --format=%h
|
||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||
|
)
|