]> granicus.if.org Git - libevent/commitdiff
remove FindGit.cmake, improve `git describe` command
authoryuangongji <yuangongji@foxmail.com>
Wed, 27 May 2020 07:39:49 +0000 (15:39 +0800)
committeryuangongji <82787816@qq.com>
Thu, 28 May 2020 12:10:47 +0000 (20:10 +0800)
Makefile.am
cmake/FindGit.cmake [deleted file]
cmake/VersionViaGit.cmake

index 9376555508123d422e669714ceddf84ea45a66f7..962c14cacb912239b574ff4b890da434c3d895e0 100644 (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 \
diff --git a/cmake/FindGit.cmake b/cmake/FindGit.cmake
deleted file mode 100644 (file)
index 2abbfe4..0000000
+++ /dev/null
@@ -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)
-
index a014c8a3edf46f6739bd5de7370a94f0f14fc34d..aedf16571c49ceb7b51ff71ba38af5cb42ad1779 100644 (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}")
-               list(LENGTH VERSION_LIST VERSION_LIST_LENGTH)
+               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)