remove FindGit.cmake, improve git describe command

(cherry picked from commit a9aa2b3607c8adf9846aa6a01e070130f4d6dcb9)
This commit is contained in:
yuangongji 2020-05-27 15:39:49 +08:00 committed by Azat Khuzhin
parent da11fcc881
commit 9a94cd9b49
3 changed files with 4 additions and 48 deletions

View File

@ -120,7 +120,6 @@ CMAKE_FILES = \
cmake/CodeCoverage.cmake \
cmake/COPYING-CMAKE-SCRIPTS \
cmake/Copyright.txt \
cmake/FindGit.cmake \
cmake/LibeventConfig.cmake.in \
cmake/LibeventConfigVersion.cmake.in \
cmake/Macros.cmake \

View File

@ -1,45 +0,0 @@
# The module defines the following variables:
# GIT_EXECUTABLE - path to git command line client
# GIT_FOUND - true if the command line client was found
# Example usage:
# find_package(Git)
# if(GIT_FOUND)
# message("git found: ${GIT_EXECUTABLE}")
# endif()
#=============================================================================
# Copyright 2010 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
# Look for 'git' or 'eg' (easy git)
set(git_names git eg)
# Prefer .cmd variants on Windows unless running in a Makefile
# in the MSYS shell.
if(WIN32)
if(NOT CMAKE_GENERATOR MATCHES "MSYS")
set(git_names git.cmd git eg.cmd eg)
endif()
endif()
find_program(GIT_EXECUTABLE
NAMES ${git_names}
DOC "git command line client")
mark_as_advanced(GIT_EXECUTABLE)
# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)

View File

@ -31,7 +31,7 @@ macro(event_fuzzy_version_from_git)
if (GIT_FOUND)
execute_process(
COMMAND
${GIT_EXECUTABLE} describe --abbrev=0
${GIT_EXECUTABLE} describe --abbrev=0 --always
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}
RESULT_VARIABLE
@ -42,7 +42,9 @@ macro(event_fuzzy_version_from_git)
)
string(REGEX REPLACE "[\\._-]" ";" VERSION_LIST "${GITVERSION}")
if(VERSION_LIST)
list(LENGTH VERSION_LIST VERSION_LIST_LENGTH)
endif()
if ((GITRET EQUAL 0) AND (VERSION_LIST_LENGTH EQUAL 5))
list(GET VERSION_LIST 1 _MAJOR)