From ff553609375f4257e9ae3cf584b4ff5c9b868e49 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 17 Jun 2021 15:48:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A7=D0=B8=D1=81=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibGit.cmake | 10 ++++++---- CMLibGitVersion.cmake | 4 +--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMLibGit.cmake b/CMLibGit.cmake index 7733432..94ced49 100644 --- a/CMLibGit.cmake +++ b/CMLibGit.cmake @@ -5,10 +5,12 @@ elseif(ARGV0) set(output_file ${ARGV0}) endif() -add_custom_target(git-version ALL ${CMAKE_COMMAND} - -DCMLIB_PROJECT_NAME_UPPER=${CMLIB_PROJECT_NAME_UPPER} - -DCMLIB_MODULE_DIR=${CMLIB_MODULE_DIR} - -DCMLIB_GIT_VERSION_FILE=${output_file} -P ${CMLIB_MODULE_DIR}/CMLibGitVersion.cmake +# cmake-format: off +add_custom_target(git-version ALL + ${CMAKE_COMMAND} -DCMLIB_PROJECT_NAME_UPPER=${CMLIB_PROJECT_NAME_UPPER} + -DCMLIB_MODULE_DIR=${CMLIB_MODULE_DIR} + -DCMLIB_GIT_VERSION_FILE=${output_file} -P ${CMLIB_MODULE_DIR}/CMLibGitVersion.cmake WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +# cmake-format: on unset(output_file) diff --git a/CMLibGitVersion.cmake b/CMLibGitVersion.cmake index 880c071..fbb9bad 100644 --- a/CMLibGitVersion.cmake +++ b/CMLibGitVersion.cmake @@ -3,8 +3,6 @@ set(CMLIB_GIT_DIFF "") set(CMLIB_GIT_TAG "N/A") set(CMLIB_GIT_BRANCH "N/A") -message("aaaaaa") - find_program(GIT_EXECUTABLE git) if(GIT_EXECUTABLE) execute_process(COMMAND git log --pretty=format:'%h' -n 1 OUTPUT_VARIABLE CMLIB_GIT_REV ERROR_QUIET) @@ -18,7 +16,7 @@ if(GIT_EXECUTABLE) execute_process(COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE CMLIB_GIT_BRANCH) string(STRIP "${CMLIB_GIT_REV}" CMLIB_GIT_REV) - string(SUBSTRING "${CMLIB_GIT_REV}" 1 8 CMLIB_GIT_REV) + string(SUBSTRING "${CMLIB_GIT_REV}" 1 7 CMLIB_GIT_REV) string(STRIP "${CMLIB_GIT_DIFF}" CMLIB_GIT_DIFF) string(STRIP "${CMLIB_GIT_TAG}" CMLIB_GIT_TAG) string(STRIP "${CMLIB_GIT_BRANCH}" CMLIB_GIT_BRANCH)