added missing files needed to get git revision.
This commit is contained in:
parent
21ccdad460
commit
258def542f
30
cmake/configure_musrfit_version_file.cmake.in
Normal file
30
cmake/configure_musrfit_version_file.cmake.in
Normal file
@ -0,0 +1,30 @@
|
||||
# configure_musrfit_version_file.cmake.in:
|
||||
set(SRC_DIR "@CMAKE_SOURCE_DIR@")
|
||||
set(BIN_DIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||
|
||||
# Set variables
|
||||
set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
|
||||
set(MUSRFIT_VERSION "@MUSRFIT_VERSION@")
|
||||
|
||||
# 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 --pretty="%h, %ci"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_CURRENT_SHA1
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${SRC_DIR}/cmake/git-revision.h.in
|
||||
${BIN_DIR}/git-revision.h
|
||||
@ONLY
|
||||
)
|
||||
# EOF
|
8
cmake/git-revision.h.in
Normal file
8
cmake/git-revision.h.in
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef GIT_VERSION_H
|
||||
#define GIT_VERSION_H
|
||||
|
||||
#define GIT_BRANCH "@GIT_BRANCH@"
|
||||
#define GIT_CURRENT_SHA1 @GIT_CURRENT_SHA1@
|
||||
|
||||
#endif // GIT_VERSION_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user