ClickHouse/cmake/git_status.cmake

23 lines
587 B
CMake
Raw Normal View History

# Print the status of the git repository (if git is available).
# This is useful for troubleshooting build failure reports
2022-05-17 17:06:13 +00:00
find_package(Git)
if (Git_FOUND)
2022-05-17 17:06:13 +00:00
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_ID
OUTPUT_STRIP_TRAILING_WHITESPACE)
2022-05-17 17:06:13 +00:00
message(STATUS "HEAD's commit hash ${GIT_COMMIT_ID}")
2022-05-17 17:06:13 +00:00
execute_process(
COMMAND ${GIT_EXECUTABLE} status
2022-05-15 12:11:31 +00:00
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE)
2022-05-17 17:06:13 +00:00
else()
2022-05-17 17:06:13 +00:00
message(STATUS "Git could not be found.")
endif()