Skip to content
Snippets Groups Projects

add git hash as a property

Merged Deepak Rangarajan requested to merge rangarad/csg-eb:add_git_hash into main
2 files
+ 27
1
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 21
0
@@ -60,3 +60,24 @@ install(EXPORT CsgEbConfig
if (CSG_CGAL_ENABLED)
target_compile_definitions(csg-eb PUBLIC USE_CGAL)
endif()
set(CSGEB_GIT_HASH "")
execute_process(
COMMAND git describe --abbrev=12 --dirty --always --tags
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE CSGEB_GIT_HASH
ERROR_VARIABLE _tmperr
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(_tmperr)
message(WARNING "Failing to retrieve Git commit from repo: ${PROJECT_SOURCE_DIR}")
endif()
set_target_properties(csg-eb PROPERTIES CSGEB_GIT_HASH ${CSGEB_GIT_HASH}
EXPORT_PROPERTIES CSGEB_GIT_HASH)
# to be used by gnumake
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CsgEbConfig.mk
"CSGEB_GIT_HASH := ${CSGEB_GIT_HASH}")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CsgEbConfig.mk
DESTINATION "${CMAKE_INSTALL_PREFIX}"
)
Loading