summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authoryuangongji <yuangongji@foxmail.com>2020-05-27 15:39:49 +0800
committeryuangongji <82787816@qq.com>2020-05-28 20:10:47 +0800
commita9aa2b3607c8adf9846aa6a01e070130f4d6dcb9 (patch)
tree3cdff4f868e1d0cc2f284db4401412222df6e539 /cmake
parent89d313b14dffed7271f41f4e2d68ccfe6b6475ed (diff)
downloadlibevent-a9aa2b3607c8adf9846aa6a01e070130f4d6dcb9.tar.gz
remove FindGit.cmake, improve `git describe` command
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindGit.cmake45
-rw-r--r--cmake/VersionViaGit.cmake6
2 files changed, 4 insertions, 47 deletions
diff --git a/cmake/FindGit.cmake b/cmake/FindGit.cmake
deleted file mode 100644
index 2abbfe4e..00000000
--- a/cmake/FindGit.cmake
+++ /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)
-
diff --git a/cmake/VersionViaGit.cmake b/cmake/VersionViaGit.cmake
index a014c8a3..aedf1657 100644
--- a/cmake/VersionViaGit.cmake
+++ b/cmake/VersionViaGit.cmake
@@ -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)