Skip to content

Commit 66484b5

Browse files
committed
Simplify git_describe to work on CMake 2.8.0.
FindGit doesn't seem to work as expected on Ubuntu 10.04 (GIT-NOTFOUND even though Git is installed and available on the $PATH). This implementation might be overly simplistic and it should probably use find_program() to locate Git. We need to revisit this after the 0.12.0 release is out.
1 parent ad126e7 commit 66484b5

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

cmake/Modules/GetGitRevisionDescription.cmake

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -74,33 +74,10 @@ function(get_git_head_revision _refspecvar _hashvar)
7474
endfunction()
7575

7676
function(git_describe _var)
77-
if(NOT GIT_FOUND)
78-
find_package(Git QUIET)
79-
endif()
80-
get_git_head_revision(refspec hash)
81-
if(NOT GIT_FOUND)
82-
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
83-
return()
84-
endif()
85-
if(NOT hash)
86-
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
87-
return()
88-
endif()
89-
90-
# TODO sanitize
91-
#if((${ARGN}" MATCHES "&&") OR
92-
# (ARGN MATCHES "||") OR
93-
# (ARGN MATCHES "\\;"))
94-
# message("Please report the following error to the project!")
95-
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
96-
#endif()
97-
98-
#message(STATUS "Arguments to execute_process: ${ARGN}")
99-
10077
execute_process(COMMAND
101-
"${GIT_EXECUTABLE}"
78+
git
10279
describe
103-
${hash}
80+
HEAD
10481
${ARGN}
10582
WORKING_DIRECTORY
10683
"${CMAKE_SOURCE_DIR}"

0 commit comments

Comments
 (0)