mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Merge branch 'cmake-strings' into 'master'
CMake:Use commit hash and branch name. Closes #37 See merge request STJr/SRB2!360
This commit is contained in:
commit
d507aa231e
3 changed files with 14 additions and 4 deletions
|
@ -98,10 +98,10 @@ add_subdirectory(assets)
|
|||
## config.h generation
|
||||
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
||||
include(GitUtilities)
|
||||
git_describe(SRB2_GIT_DESCRIBE "${CMAKE_SOURCE_DIR}")
|
||||
git_latest_commit(SRB2_COMP_COMMIT "${CMAKE_SOURCE_DIR}")
|
||||
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
|
||||
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
|
||||
set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}")
|
||||
set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}")
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
||||
|
||||
##### PACKAGE CONFIGURATION #####
|
||||
|
|
|
@ -29,3 +29,15 @@ function(git_current_branch variable path)
|
|||
|
||||
set(${variable} "${output}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_latest_commit variable path)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} "rev-parse" "--short" "HEAD"
|
||||
WORKING_DIRECTORY "${path}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
set(${variable} "${output}" PARENT_SCOPE)
|
||||
endfunction()
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
|
||||
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
|
||||
#define SRB2_GIT_DESCRIBE "${SRB2_GIT_DESCRIBE}"
|
||||
#define SRB2_GIT_BRANCH "${SRB2_GIT_BRANCH}"
|
||||
|
||||
#define CMAKE_ASSETS_DIR "${CMAKE_SOURCE_DIR}/assets"
|
||||
|
||||
|
|
Loading…
Reference in a new issue