Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/google_benchmark/cmake/GetGitVersion.cmake

Issue 2865663003: Adding Google benchmarking library. (Closed)
Patch Set: Sketch. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # - Returns a version string from Git tags
2 #
3 # This function inspects the annotated git tags for the project and returns a st ring
4 # into a CMake variable
5 #
6 # get_git_version(<var>)
7 #
8 # - Example
9 #
10 # include(GetGitVersion)
11 # get_git_version(GIT_VERSION)
12 #
13 # Requires CMake 2.8.11+
14 find_package(Git)
15
16 if(__get_git_version)
17 return()
18 endif()
19 set(__get_git_version INCLUDED)
20
21 function(get_git_version var)
22 if(GIT_EXECUTABLE)
23 execute_process(COMMAND ${GIT_EXECUTABLE} describe --match "v[0-9]*.[0-9]* .[0-9]*" --abbrev=8
24 RESULT_VARIABLE status
25 OUTPUT_VARIABLE GIT_VERSION
26 ERROR_QUIET)
27 if(${status})
28 set(GIT_VERSION "v0.0.0")
29 else()
30 string(STRIP ${GIT_VERSION} GIT_VERSION)
31 string(REGEX REPLACE "-[0-9]+-g" "-" GIT_VERSION ${GIT_VERSION})
32 endif()
33
34 # Work out if the repository is dirty
35 execute_process(COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
36 OUTPUT_QUIET
37 ERROR_QUIET)
38 execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD --
39 OUTPUT_VARIABLE GIT_DIFF_INDEX
40 ERROR_QUIET)
41 string(COMPARE NOTEQUAL "${GIT_DIFF_INDEX}" "" GIT_DIRTY)
42 if (${GIT_DIRTY})
43 set(GIT_VERSION "${GIT_VERSION}-dirty")
44 endif()
45 else()
46 set(GIT_VERSION "v0.0.0")
47 endif()
48
49 message("-- git Version: ${GIT_VERSION}")
50 set(${var} ${GIT_VERSION} PARENT_SCOPE)
51 endfunction()
OLDNEW
« no previous file with comments | « third_party/google_benchmark/cmake/Config.cmake.in ('k') | third_party/google_benchmark/cmake/gnu_posix_regex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698