mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Make this be consistent with non-CMake builds
This commit is contained in:
parent
1b6ec9fd33
commit
fbb2cde800
3 changed files with 14 additions and 4 deletions
|
@ -98,10 +98,10 @@ add_subdirectory(assets)
|
||||||
## config.h generation
|
## config.h generation
|
||||||
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
||||||
include(GitUtilities)
|
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}")
|
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
|
||||||
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
|
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)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
||||||
|
|
||||||
##### PACKAGE CONFIGURATION #####
|
##### PACKAGE CONFIGURATION #####
|
||||||
|
|
|
@ -29,3 +29,15 @@ function(git_current_branch variable path)
|
||||||
|
|
||||||
set(${variable} "${output}" PARENT_SCOPE)
|
set(${variable} "${output}" PARENT_SCOPE)
|
||||||
endfunction()
|
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_REVISION "${SRB2_COMP_REVISION}"
|
||||||
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
|
#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"
|
#define CMAKE_ASSETS_DIR "${CMAKE_SOURCE_DIR}/assets"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue