@@ -83,7 +83,7 @@ set(COUNT 0)
83
83
find_package(Git)
84
84
if(Git_FOUND)
85
85
execute_process(
86
- COMMAND \$ {GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
86
+ COMMAND \$ {GIT_EXECUTABLE} rev-parse HEAD
87
87
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
88
88
OUTPUT_VARIABLE TEMP_HEAD
89
89
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -102,24 +102,24 @@ if(Git_FOUND)
102
102
endif()
103
103
endif()
104
104
105
- file(WRITE \" ${CMAKE_SOURCE_DIR} /build-info.h\" \" #pragma once\\ n#define BUILD_NUMBER \$ {COUNT}\\ n#define BUILD_BRANCH \\\"\$ {HEAD}\\\"\\ n\" )
105
+ file(WRITE \" ${CMAKE_SOURCE_DIR} /build-info.h\" \" #pragma once\\ n#define BUILD_NUMBER \$ {COUNT}\\ n#define BUILD_COMMIT \\\"\$ {HEAD}\\\"\\ n\" )
106
106
" )
107
107
108
108
# Call the script to generate build-info.h initially
109
109
execute_process (
110
110
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -P ${CMAKE_BINARY_DIR} /BUILD_INFO.cmake
111
111
)
112
112
113
- if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR } /.git" )
113
+ if (EXISTS "${CMAKE_SOURCE_DIR } /.git" )
114
114
# Add a custom target to regenerate build-info.h when .git/index changes
115
- add_custom_target (BUILD_INFO ALL DEPENDS "${CMAKE_CURRENT_SOURCE_DIR } /build-info.h" )
115
+ add_custom_target (BUILD_INFO ALL DEPENDS "${CMAKE_SOURCE_DIR } /build-info.h" )
116
116
117
117
# Add a custom command to generate build-info.h when .git/index changes
118
118
add_custom_command (
119
- OUTPUT "${CMAKE_CURRENT_SOURCE_DIR } /build-info.h"
119
+ OUTPUT "${CMAKE_SOURCE_DIR } /build-info.h"
120
120
COMMENT "Updating build-info.h"
121
121
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -P ${CMAKE_BINARY_DIR} /BUILD_INFO.cmake
122
- DEPENDS "${CMAKE_CURRENT_SOURCE_DIR } /.git/index"
122
+ DEPENDS "${CMAKE_SOURCE_DIR } /.git/index"
123
123
VERBATIM
124
124
)
125
125
endif ()
0 commit comments