From 66484b580aac3f2d9c0ac121ffc24368838cae6a Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Tue, 15 Oct 2013 23:25:10 +0200 Subject: [PATCH] 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. --- cmake/Modules/GetGitRevisionDescription.cmake | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/cmake/Modules/GetGitRevisionDescription.cmake b/cmake/Modules/GetGitRevisionDescription.cmake index d3d5f1eb..19f8432f 100644 --- a/cmake/Modules/GetGitRevisionDescription.cmake +++ b/cmake/Modules/GetGitRevisionDescription.cmake @@ -74,33 +74,10 @@ function(get_git_head_revision _refspecvar _hashvar) endfunction() function(git_describe _var) - if(NOT GIT_FOUND) - find_package(Git QUIET) - endif() - get_git_head_revision(refspec hash) - if(NOT GIT_FOUND) - set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) - return() - endif() - if(NOT hash) - set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) - return() - endif() - - # TODO sanitize - #if((${ARGN}" MATCHES "&&") OR - # (ARGN MATCHES "||") OR - # (ARGN MATCHES "\\;")) - # message("Please report the following error to the project!") - # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") - #endif() - - #message(STATUS "Arguments to execute_process: ${ARGN}") - execute_process(COMMAND - "${GIT_EXECUTABLE}" + git describe - ${hash} + HEAD ${ARGN} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"